instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I'm using MessageFormat to format some addresses with a template like this: "{0}\n{1}\n{2}\n{3}, {4} {5}" where 0 = street 1 1 = street 2 2 = street 3 3 = city 4 = state 5 = zip Most of these fields are optional when captured. How do I avoid having an empty line when for instance, there is not street 3? I could us...
Java's `MessageFormat` does not support conditional formatting directly within its string template. However, you can achieve the desired formatting using a combination of string manipulation and `StringBuilder`, or by using a more powerful templating library that supports conditionals. Here are a few options you could...
29,962
[ { "from": "human", "value": "I'm using MessageFormat to format some addresses with a template like this:\n\"{0}\\n{1}\\n{2}\\n{3}, {4} {5}\"\n\nwhere\n\n0 = street 1\n1 = street 2\n2 = street 3\n3 = city\n4 = state\n5 = zip\n\nMost of these fields are optional when captured. How do I avoid having an empty ...
The original question is below, but I changed the title because I think it will be easier to find others with the same doubt. In the end, a XHTML document is a XML document. It's a beginner question, but I would like to know which do you think is the best library for parsing XHTML documents in PHP5? I have generated th...
Parsing XHTML in PHP can be done using a few different libraries, and the best choice often depends on your specific needs and preferences. Given that you’re working with XHTML and need to manipulate elements and attributes, here are some options you can consider: 1. **DOMDocument (DOM Extension)**: - **Pros**: The...
27,300
[ { "from": "human", "value": "The original question is below, but I changed the title because I think it will be easier to find others with the same doubt. In the end, a XHTML document is a XML document.\nIt's a beginner question, but I would like to know which do you think is the best library for parsing XH...
While working on a C# app I just noticed that in several places static initializers have dependencies on each other like this: static private List<int> a = new List<int>() { 0 }; static private List<int> b = new List<int>() { a[0] }; Without doing anything special that worked. Is that just luck? Does C# have rules to ...
In C#, static fields are initialized in the order they are declared within a class. This means that if you have two static fields that depend on each other, they are initialized according to the order of their declarations, which can lead to unpredictable behavior if you're not careful. ### Order of Initialization Whe...
31,992
[ { "from": "human", "value": "While working on a C# app I just noticed that in several places static initializers have dependencies on each other like this:\nstatic private List<int> a = new List<int>() { 0 };\nstatic private List<int> b = new List<int>() { a[0] };\n\nWithout doing anything special that work...
Can you post a short example of real, overdone spaghetti code, possibly saying what it does? Can you show me a little debugger's nightmare? I don't mean IOCCC code, that is science fiction. I mean real life examples that happened to you... Update The focus has changed from "post some spaghetti code" to "what is exactly...
Spaghetti code refers to code that is convoluted, tangled, and difficult to follow due to poor structure and a lack of clear organization. It often emerges from practices like excessive use of global variables, deep nesting of control structures, inconsistent naming conventions, and improper handling of function or met...
19,668
[ { "from": "human", "value": "Can you post a short example of real, overdone spaghetti code, possibly saying what it does? Can you show me a little debugger's nightmare?\nI don't mean IOCCC code, that is science fiction. I mean real life examples that happened to you...\nUpdate\nThe focus has changed from \"...
I have 3 classes that are essentially the same but don't implement an interface because they all come from different web services. e.g. Service1.Object1 Service2.Object1 Service3.Object1 They all have the same properties and I am writing some code to map them to each other using an intermediary object which implemen...
In C#, you cannot specify multiple types as constraints directly in a generic type parameter using the `where` clause. The generic type constraint must be a single type or a class/interface. Unfortunately, this limitation means that you cannot enforce at compile-time that `T` is one of multiple specific types without m...
26,429
[ { "from": "human", "value": "I have 3 classes that are essentially the same but don't implement an interface because they all come from different web services. \ne.g.\n\nService1.Object1\nService2.Object1\nService3.Object1\n\nThey all have the same properties and I am writing some code to map them to each o...
I want to check if a given date is more than a month earlier than today's date using LINQ. What is the syntax for this? Thanks in advance.
To check if a given date is more than a month earlier than today's date using LINQ, you can use the `DateTime` class in C# along with the `DateTime.AddMonths()` method. The LINQ part typically comes into play when you're filtering a collection of dates, but for a single date check, you can simply use the `DateTime` com...
30,713
[ { "from": "human", "value": "I want to check if a given date is more than a month earlier than today's date using LINQ.\nWhat is the syntax for this?\nThanks in advance.\n" }, { "from": "gpt", "value": "To check if a given date is more than a month earlier than today's date using LINQ, you can u...
I can access my calendar entries as: $folder = $namespace->Folders("Joe Cool")->Folders("Calendar"); How do I open "Jane Cool" Calendar? Outlook shows that calendar as: People's Calendar Jane Cool
To access "Jane Cool's" calendar in Outlook using the provided syntax, you would need to adjust the folder hierarchy based on how the calendar is structured in Outlook. Given that Outlook shows it as "People's Calendar" followed by "Jane Cool", you would access it in a similar manner as you did for "Joe Cool". Here is...
35,004
[ { "from": "human", "value": "I can access my calendar entries as:\n$folder = $namespace->Folders(\"Joe Cool\")->Folders(\"Calendar\");\n\nHow do I open \"Jane Cool\" Calendar? Outlook shows that calendar as:\nPeople's Calendar\n Jane Cool\n\n" }, { "from": "gpt", "value": "To access \"Jane Coo...
I am currently working on software that must emit SNMP traps for SNMP versions 1 & 2 and possibly v3 in the future. I have downloaded several and found them to be either too complex or too simplistic. All I want is to view traps and analyze the data structures within them, and the ability to import my custom MIB's. The...
If you're looking for SNMP trap viewers and MIB browsers that are user-friendly and allow for custom MIB imports, here are some alternatives to iReasoning's MIB Browser that you might find useful: 1. **SNMP MIB Browser from ManageEngine**: - ManageEngine provides a comprehensive SNMP MIB Browser that supports SNMP ...
31,180
[ { "from": "human", "value": "I am currently working on software that must emit SNMP traps for SNMP versions 1 & 2 and possibly v3 in the future. I have downloaded several and found them to be either too complex or too simplistic. All I want is to view traps and analyze the data structures within them, and t...
I have an abstract base class with a TcpClient field: public abstract class ControllerBase { internal protected TcpClient tcpClient; It has a method to setup a connection: private void setupConnection(IPAddress EthernetAddress, ushort TcpPort) { if (this.tcpClient == null || !this.tcpClient.Connected) ...
The issue you're facing seems to be related to the scope and lifecycle of the `TcpClient` instance in your `ControllerBase` class. Since you mentioned that the `TcpClient` appears to be disposed between calls, there are a few potential causes for this behavior: 1. **Multiple Instances**: Ensure that you are using the ...
29,172
[ { "from": "human", "value": "I have an abstract base class with a TcpClient field:\npublic abstract class ControllerBase\n{\n internal protected TcpClient tcpClient;\n\nIt has a method to setup a connection:\nprivate void setupConnection(IPAddress EthernetAddress, ushort TcpPort)\n {\n if (this...
I'm using the PHP Eclipse. When a XML file is opened, Eclipse doesn't seem to recognize the xml, meaning that all looks black. When opened the XML file like "open with" and point to eclipse, it works fine. What setting can be set to use that automatically so that eclipse recognizes it all the time? Same goes for HTML f...
To ensure that Eclipse recognizes XML and HTML files automatically, you can adjust the file associations in Eclipse. Here’s how to do it: ### Step 1: Set File Associations 1. **Open Eclipse**: Launch your Eclipse IDE. 2. **Preferences**: Go to `Window` > `Preferences` (or `Eclipse` > `Preferences` on macOS). 3. **Gen...
28,269
[ { "from": "human", "value": "I'm using the PHP Eclipse.\nWhen a XML file is opened, Eclipse doesn't seem to recognize the xml, meaning that all looks black.\nWhen opened the XML file like \"open with\" and point to eclipse, it works fine.\nWhat setting can be set to use that automatically so that eclipse re...
I am wondering what are the possible value for *_la_LDFLAGS in Makefile.am ? If I ask this question, it is because I would like the following : Actual shared library : libA.so (or with the version number I don't care) Symbolic links : libA-X.Y.Z.so, libA-X.so, libA.so soname : libA-X.so However...
In a `Makefile.am`, the `*_la_LDFLAGS` variable (where `*` is replaced with the name of your library) is used to specify linker flags for building shared libraries. The values you can set in `*_la_LDFLAGS` will affect how your shared library is built, including the naming of the output files and symbolic links. To ach...
29,184
[ { "from": "human", "value": "I am wondering what are the possible value for *_la_LDFLAGS in Makefile.am ? \nIf I ask this question, it is because I would like the following :\nActual shared library : libA.so (or with the version number I don't care)\nSymbolic links : libA-X.Y.Z.so, libA-X.so, libA.so...
I have a SQL Mobile database with one table. It has several columns with useful, often queried data and one column that stores a relatively large string per record (1000+ characters) that is not queried often. Imagine this fake schema, the "lifeStory" field is the large one. table1 String firstName String lastName Stri...
Leaving a large column, such as `lifeStory`, in your table when it is infrequently queried can lead to several performance concerns, especially in a SQL Mobile database where resources may be limited. Here are some of the potential issues: 1. **Increased I/O and Memory Usage**: When you query the table, even though yo...
32,272
[ { "from": "human", "value": "I have a SQL Mobile database with one table. It has several columns with useful, often queried data and one column that stores a relatively large string per record (1000+ characters) that is not queried often.\nImagine this fake schema, the \"lifeStory\" field is the large one.\...
I'm using javax.mail to retrieve mails from GMail using IMAP. I want to also obtain the tags being applied to each mail, so I'm iterating over all the folders in the store (which actually are tags) and downloading mails for each other. I was using the method getUID of ImapFolder to obtain the UID for each message, and ...
When using the JavaMail API with IMAP to interact with Gmail, it's important to understand how message IDs and UIDs work in the context of IMAP folders. Unfortunately, IMAP does not provide a native way to get a global (store-wide) unique identifier for a message that would be consistent across folders. Each folder mai...
29,705
[ { "from": "human", "value": "I'm using javax.mail to retrieve mails from GMail using IMAP. I want to also obtain the tags being applied to each mail, so I'm iterating over all the folders in the store (which actually are tags) and downloading mails for each other.\nI was using the method getUID of ImapFolde...
SSIS 2005/2008 does fuzzy lookups and groupings. Is there a feature that does the same in T-SQL?
In T-SQL, there is no direct equivalent to the Fuzzy Lookup and Fuzzy Grouping features found in SQL Server Integration Services (SSIS) 2005/2008. However, you can implement similar functionality using various techniques and functions available in SQL Server. Here are a few approaches you can use for fuzzy matching or...
31,141
[ { "from": "human", "value": "SSIS 2005/2008 does fuzzy lookups and groupings. Is there a feature that does the same in T-SQL?\n" }, { "from": "gpt", "value": "In T-SQL, there is no direct equivalent to the Fuzzy Lookup and Fuzzy Grouping features found in SQL Server Integration Services (SSIS) ...
What is the difference between int *a[3] and int (*a)[3]?
The difference between `int *a[3]` and `int (*a)[3]` lies in the way they are defined and what they represent in C or C++. 1. **`int *a[3]`**: - This declaration defines `a` as an array of 3 pointers to integers. - Here, `a` is an array that can hold three elements, and each element is a pointer to an `int`. ...
33,780
[ { "from": "human", "value": "What is the difference between int *a[3] and int (*a)[3]?\n" }, { "from": "gpt", "value": "The difference between `int *a[3]` and `int (*a)[3]` lies in the way they are defined and what they represent in C or C++.\n\n1. **`int *a[3]`**:\n - This declaration defines...
Does anyone know if it is possible to add other controls to a Flex 3 Alert? What I need is a modal dialoge that allows the user to type in a filename before clicking OK or CANCEL. This seems like it would be best achieved with an Alert but in the documentation I don't see an obvious way to add a TextInput (or any other...
In Flex 3, the built-in Alert class is limited to buttons and does not allow for the addition of other UI components, such as a TextInput, directly within the Alert. However, you can achieve your desired functionality by creating a custom modal dialog. Here’s how you can create a custom modal dialog that includes a Te...
28,005
[ { "from": "human", "value": "Does anyone know if it is possible to add other controls to a Flex 3 Alert? What I need is a modal dialoge that allows the user to type in a filename before clicking OK or CANCEL. This seems like it would be best achieved with an Alert but in the documentation I don't see an obv...
I'm trying to add an header file to dev-C++ but when I compile it it doesn't work. Here are my exact steps (for my example, I'm trying to get mysql.h to work): copy "mysql.h" into c:\dev-c++\includes check that in dev-C++ tools > compiler options > directories > c includes and c++ includes have the path to "c:\dev-c++...
It sounds like you are following the right steps to include a header file in Dev-C++, but there are a few additional considerations to ensure that the MySQL library is set up correctly. Here’s a checklist you can follow to resolve the issues: ### Step-by-Step Checklist 1. **Copying Header Files**: - Ensure that yo...
28,915
[ { "from": "human", "value": "I'm trying to add an header file to dev-C++ but when I compile it it doesn't work.\nHere are my exact steps (for my example, I'm trying to get mysql.h to work):\n\ncopy \"mysql.h\" into c:\\dev-c++\\includes\ncheck that in dev-C++ tools > compiler options > directories > c inclu...
I am looking for an addin that will allow me to click a button on the VS toolbar and the following actions should happen. On the highlighted project/folder/item from either Source Control Explorer or Solution Explorer, do a 'Get Specific Version' Click those 2 checkboxes, hit the 'Get' button on that dialog alt text ...
Creating a Visual Studio add-in to automate the "Get Specific Version" operation is a great idea, especially if you find yourself doing it frequently. While there might not be a specific add-in that does exactly what you're looking for out-of-the-box, you can certainly create one yourself using the Visual Studio SDK. ...
31,099
[ { "from": "human", "value": "I am looking for an addin that will allow me to click a button on the VS toolbar and the following actions should happen.\n\nOn the highlighted project/folder/item from either Source Control Explorer or Solution Explorer, do a 'Get Specific Version'\nClick those 2 checkboxes, hi...
I have an object instance which I access with the ME as it accesses the instantiated object. I have a method that gets a collection of these objects and I wish to assign the first one to the instantiated object. This is some of the code Dim Books As New BookCollection(True) Books.ListByThemeFeatured(ThemeID, 1) ' Fill...
In Visual Basic .NET (VB.NET), you cannot directly assign a new instance of an object to `Me`, as `Me` refers to the current instance of the class and cannot be re-assigned to another instance. However, you can copy the properties of the object you want to assign to the current instance. Assuming that your `BookCollec...
33,107
[ { "from": "human", "value": "I have an object instance which I access with the ME as it accesses the instantiated object. I have a method that gets a collection of these objects and I wish to assign the first one to the instantiated object. \nThis is some of the code\nDim Books As New BookCollection(True)\n...
I wrote a batch script which recursively updates my source code against the company's working base. When conflicts occur, it prompts for an action. What is the difference between 'base' and 'theirs-full'? Does 'mine-full' means "keep my changes at the working copy, I'll commit them later"?
In the context of version control, particularly systems like Git or Subversion (SVN), the terms "base," "theirs-full," and "mine-full" refer to different versions of the code during a merge conflict. 1. **Base**: This refers to the common ancestor of the two branches that are being merged. It represents the last share...
34,340
[ { "from": "human", "value": "I wrote a batch script which recursively updates my source code against the company's working base. When conflicts occur, it prompts for an action. What is the difference between 'base' and 'theirs-full'? Does 'mine-full' means \"keep my changes at the working copy, I'll commit ...
I want to create an ini file to store some settings for my application. Is it a good idea to find where the jar file is located and create an ini file there? If yes, then how can I find the location of the jar file? But if you know a better solution for something like this, I would like to hear some of them. EDIT: I'm...
Storing configuration files alongside your application (such as an INI file) can be a good approach, especially for keeping settings local to the application. However, there are some considerations depending on the operating system and how your users might interact with the application. Below are details regarding your...
28,416
[ { "from": "human", "value": "I want to create an ini file to store some settings for my application. Is it a good idea to find where the jar file is located and create an ini file there? If yes, then how can I find the location of the jar file? \nBut if you know a better solution for something like this, I ...
My solution includes these two projects: MyNamespace.Web.UI MyNamespace.Web.Core UI references Core, and Core references Foobar.dll, which exists nowhere except my library. When I build from Visual Studio 2008 Foobar.dll is in the UI project's Bin folder as expected. I have made certain it was not there before the ...
The issue you're facing with the `Foobar.dll` (or `NHibernate.ProxyGenerators.CastleDynamicProxy.dll`) not being copied to the `Bin` folder during the NAnt build can arise from a few different reasons. Here are some steps and considerations to troubleshoot the problem: 1. **Check the Project References**: - Make su...
30,044
[ { "from": "human", "value": "My solution includes these two projects:\n\nMyNamespace.Web.UI\nMyNamespace.Web.Core\n\nUI references Core, and Core references Foobar.dll, which exists nowhere except my library. When I build from Visual Studio 2008 Foobar.dll is in the UI project's Bin folder as expected. I ...
What's the quickest way to convert a date in one format, say 2008-06-01 to a date in another format, say Sun 1st June 2008 The important bit is actually the 'Sun' because depending on the dayname, I may need to fiddle other things around - in a non-deterministic fashion. I'm running GNU bash, version 3.2.17(1)-re...
You can achieve this date conversion using the `date` command in bash. Here's a quick one-liner that converts the date from the format `YYYY-MM-DD` to `Sun 1st June 2008`: ```bash date -d '2008-06-01' '+%a %d%S %B %Y' ``` However, GNU `date` on macOS (which you seem to be using) does not support the `-d` option. You ...
33,542
[ { "from": "human", "value": "What's the quickest way to convert a date in one format, say \n\n2008-06-01\n\nto a date in another format, say \n\nSun 1st June 2008\n\nThe important bit is actually the 'Sun' because depending on the dayname, I may need to fiddle other things around - in a non-deterministic fa...
I was wondering if there is some way to name or rename a property on an Anonymous type to include a space in the property name. For example: var resultSet = from customer in customerList select new { FirstName = customer.firstName; }; In this example I would like FirstName to be "First Name". The...
In C#, when you're using anonymous types, the property names must be valid C# identifiers, which means they cannot contain spaces. Therefore, you cannot directly create a property in an anonymous type with a space in its name, like "First Name". However, if you want to use column names with spaces when binding to a us...
29,122
[ { "from": "human", "value": "I was wondering if there is some way to name or rename a property on an Anonymous type to include a space in the property name. For example:\nvar resultSet = from customer in customerList\n select new \n {\n FirstName = customer.firstName;\n };\n\nIn this example...
I've inherited someone else's monster of a BASH script. The script was written in such a way that it uses a ridiculous amount of memory (around 1GB). I can run it from a shell with out issue, but if I run it from cron I crashes with a sig fault. Apart from digging into the poorly commented behemoth, is there a way ...
Hi Steve, When running a BASH script from cron, several factors can differ from running it in an interactive shell, which might contribute to the SIGSEGV (segmentation fault) you're encountering. Here are some strategies to help you troubleshoot and potentially resolve the issue: 1. **Environment Variables**: The env...
29,645
[ { "from": "human", "value": "I've inherited someone else's monster of a BASH script. The script was written in such a way that it uses a ridiculous amount of memory (around 1GB). I can run it from a shell with out issue, but if I run it from cron I crashes with a sig fault. \nApart from digging into the ...
I have the age-old problem of a div wrapping a two-column layout. My sidebar is floated, so my container div fails to wrap the content and sidebar. <div id="container"> <div id="content"></div> <div id="sidebar"></div> </div> There seem to be numerous methods of fixing the clear bug in Firefox: <br clear="all"/> ...
The issue you're experiencing with the floating layout is a common one in web development. The problem arises because floated elements are taken out of the normal flow of the document, causing their parent container to collapse. To resolve this issue, there are several well-established methods, and among them, the most...
31,290
[ { "from": "human", "value": "I have the age-old problem of a div wrapping a two-column layout. My sidebar is floated, so my container div fails to wrap the content and sidebar.\n<div id=\"container\">\n <div id=\"content\"></div>\n <div id=\"sidebar\"></div>\n</div>\n\nThere seem to be numerous methods of...
I'm working on a consumer web app that needs to do a long running background process that is tied to each customer request. By long running, I mean anywhere between 1 and 3 minutes. Here is an example flow. The object/widget doesn't really matter. Customer comes to the site and specifies object/widget they are looking...
Your intuition about separating the long-running process from the web layer is spot on. Here are some insights and suggestions to help you design an architecture that suits your needs: ### 1. Separation of Concerns **Why Separate?** - Keeping the long-running process separate from the Apache layer ensures that web se...
24,554
[ { "from": "human", "value": "I'm working on a consumer web app that needs to do a long running background process that is tied to each customer request. By long running, I mean anywhere between 1 and 3 minutes.\nHere is an example flow. The object/widget doesn't really matter.\n\nCustomer comes to the site ...
Is there a way to specify which monitor a application appears on in Delphi or C++Builder? I am developing a simple program for a customer, which displays kitchen orders on a secondary monitor, generated by a hospitality system. Currently they need to manually drag the window onto the second monitor after it starts.
Yes, in Delphi or C++Builder, you can specify which monitor an application window should appear on by setting its position programmatically. Here's how to do it: 1. **Get the list of monitors**: You can use the `Screen` object, which provides information about all connected monitors. 2. **Set the window's position**:...
30,340
[ { "from": "human", "value": "Is there a way to specify which monitor a application appears on in Delphi or C++Builder? \nI am developing a simple program for a customer, which displays kitchen orders on a secondary monitor, generated by a hospitality system. Currently they need to manually drag the window...
As JavaScript frameworks like jQuery make client side web applications richer and more functional, I've started to notice one problem... How in the world do you keep this organized? Put all your handlers in one spot and write functions for all the events? Create function/classes to wrap all your functionality? Write l...
Organizing JavaScript code, especially in larger applications, can be challenging but is crucial for maintainability, readability, and scalability. Here are some best practices and strategies to keep your JavaScript code clean and organized: ### 1. **Modularization** - **Modules**: Use ES6 modules (or module patter...
29,546
[ { "from": "human", "value": "As JavaScript frameworks like jQuery make client side web applications richer and more functional, I've started to notice one problem...\nHow in the world do you keep this organized?\n\nPut all your handlers in one spot and write functions for all the events?\nCreate function/cl...
I'm building a .NET client application (C#, WinForms) that uses a web service for interaction with the database. The client will be run from remote locations using a WAN or VPN, hence the idea of using a web service rather than direct database access. The issue I'm grappling with right now is how to handle database con...
Handling concurrency in a distributed application is a common challenge, particularly when multiple users can modify the same data at the same time. Your approach of using timestamps (or versioning) is valid and widely used, but let's explore various strategies, including best practices for your specific scenario. ###...
26,322
[ { "from": "human", "value": "I'm building a .NET client application (C#, WinForms) that uses a web service for interaction with the database. The client will be run from remote locations using a WAN or VPN, hence the idea of using a web service rather than direct database access.\nThe issue I'm grappling wi...
I'm running programs from Eclipse (on Windows) that eat a lot of CPU time. To avoid bogging down my whole machine, I set the priority to Low with the Task Manager. However, this is a cumbersome manual process. Is there a way Eclipse can set this priority automatically? EDIT: I realized that each particular launcher (Ja...
To set the priority of Java applications launched from Eclipse automatically, you can create a simple Java program or a script to modify the process priority after launching the Java application. Eclipse itself does not provide built-in support for setting process priorities directly, but you can employ a few approache...
25,425
[ { "from": "human", "value": "I'm running programs from Eclipse (on Windows) that eat a lot of CPU time. To avoid bogging down my whole machine, I set the priority to Low with the Task Manager. However, this is a cumbersome manual process. Is there a way Eclipse can set this priority automatically?\nEDIT: I ...
What is the the best of detecting and later altering the screen resolution and multiple desktop within .net I have a small app that while runs at work on my multiple monitor/high(ish) resolution however what I want to be able to detect is the users primary monitor and set the application to that (main objective) and ad...
To achieve your objective of detecting the user's primary monitor and adjusting the application's screen resolution accordingly in a .NET application, you can use the `System.Windows.Forms` namespace, which provides classes for working with Windows Forms applications. Below are the steps and example code snippets to he...
24,397
[ { "from": "human", "value": "What is the the best of detecting and later altering the screen resolution and multiple desktop within .net\nI have a small app that while runs at work on my multiple monitor/high(ish) resolution however what I want to be able to detect is the users primary monitor and set the a...
My situation Input: a set of rectangles each rect is comprised of 4 doubles like this: (x0,y0,x1,y1) they are not "rotated" at any angle, all they are "normal" rectangles that go "up/down" and "left/right" with respect to the screen they are randomly placed - they may be touching at the edges, overlapping , or not ha...
To solve the problem of calculating the overlapping area of a set of rectangles in C#, you can use a grid-based approach. The idea is to discretize the area of the rectangles into a grid of cells, where each cell can be marked as covered or not covered based on the rectangles. This allows you to efficiently count the n...
25,348
[ { "from": "human", "value": "My situation\n\nInput: a set of rectangles \neach rect is comprised of 4 doubles like this: (x0,y0,x1,y1)\nthey are not \"rotated\" at any angle, all they are \"normal\" rectangles that go \"up/down\" and \"left/right\" with respect to the screen\nthey are randomly placed - they...
I am working on a windows service that polls for a connection to a network enabled devices every 15 seconds. If the service is not able to connect to a device, it throws an exception and tries again in 15 seconds. All of this works great. But, lets say one of the devices is down for a day or more. I am filling up my...
Yes, it’s a common scenario to want to reduce the noise in your logs when dealing with repeated exceptions. One approach is to implement a throttling mechanism that will allow you to suppress the same exception for a certain period. Here’s a suggested approach to achieve that: ### Steps to Implement Exception Throttli...
25,696
[ { "from": "human", "value": "I am working on a windows service that polls for a connection to a network enabled devices every 15 seconds. If the service is not able to connect to a device, it throws an exception and tries again in 15 seconds. All of this works great.\nBut, lets say one of the devices is d...
I'm trying to write a small app that monitors how much power is left in a notebook battery and I'd like to know which Win32 function I could use to accomplish that.
To monitor the battery status on a Windows system using the Win32 API, you can use the `GetSystemPowerStatus` function. This function retrieves information about the system's current power status, including details about the battery status. Here's a quick overview of how to use it: 1. Include the necessary headers: ...
30,225
[ { "from": "human", "value": "I'm trying to write a small app that monitors how much power is left in a notebook battery and I'd like to know which Win32 function I could use to accomplish that.\n" }, { "from": "gpt", "value": "To monitor the battery status on a Windows system using the Win32 API...
Identicons are those icons based on a user IP or name or so which provide an automated avatar... just like the avatar icon on StackOverflow. Here are some available systems (hat tip to Roger Browne): http://haacked.com/archive/2007/01/22/Identicons_as_Visual_Fingerprints.aspx http://digitalconsumption.com/forum/Visigl...
Yes, there are several other systems and libraries for generating identicons or similar visual representations based on user input, such as IP addresses or usernames. Here are some additional resources that might interest you: 1. **Gravatar**: While not exactly identicons, Gravatar allows users to associate an image w...
28,801
[ { "from": "human", "value": "Identicons are those icons based on a user IP or name or so which provide an automated avatar... just like the avatar icon on StackOverflow. Here are some available systems (hat tip to Roger Browne):\n\nhttp://haacked.com/archive/2007/01/22/Identicons_as_Visual_Fingerprints.aspx...
I have a slight problem reading data from file. I want to be able to read wstring's, aswell as a chunk of raw data of arbitrary size (size is in bytes). std::wfstream stream(file.c_str()); std::wstring comType; stream >> comType; int comSize; stream >> comSize; char *comData = new char[comSize]; memset(comData, 0, ...
You're correct that using `std::wfstream` leads to issues when trying to read raw byte data because it is designed to work with wide characters (`wchar_t`) and not with raw bytes. As such, it won't accept a `char*` as the destination for reading. To address your requirements effectively, consider the following approach...
28,381
[ { "from": "human", "value": "I have a slight problem reading data from file. I want to be able to read wstring's, aswell as a chunk of raw data of arbitrary size (size is in bytes). \nstd::wfstream stream(file.c_str());\n\nstd::wstring comType;\nstream >> comType;\n\nint comSize;\nstream >> comSize;\n\nchar...
For example: Base class header file has: enum FOO { FOO_A, FOO_B, FOO_C, FOO_USERSTART }; Then the derived class has: enum FOO { FOO_USERA=FOO_USERSTART FOO_USERB, FOO_USERC }; Just to be clear on my usage it is for having an event handler where the base class has events and then derived classes can add events. The d...
The design you have outlined for your event handling system using enums and class inheritance looks reasonable. However, there are a few improvements you can make to ensure better clarity and correctness. Let's address a few points, including fixing enum definitions, making the `HandleFoo` methods more robust, and ensu...
30,164
[ { "from": "human", "value": "For example:\nBase class header file has:\nenum FOO\n{\nFOO_A,\nFOO_B,\nFOO_C,\nFOO_USERSTART\n};\n\nThen the derived class has:\nenum FOO\n{\nFOO_USERA=FOO_USERSTART\nFOO_USERB,\nFOO_USERC\n};\n\nJust to be clear on my usage it is for having an event handler where the base clas...
I want to program graphical 2D games more complex than the basic 2D stuff I already know. I don't want to do 3D programming. Just more complex 2D stuff. I dropped high school before I could learn a lot of stuff so I walked away with enough algebra knowledge to balance my checkbook and do some light 2D Cartesian program...
Absolutely! There are plenty of resources tailored to help you build your math skills for 2D game development without diving into 3D. Since you prefer short, digestible pieces of information, I've curated a list of various types of resources including videos, online courses, and articles. Here are some that might help ...
29,216
[ { "from": "human", "value": "I want to program graphical 2D games more complex than the basic 2D stuff I already know. I don't want to do 3D programming. Just more complex 2D stuff. I dropped high school before I could learn a lot of stuff so I walked away with enough algebra knowledge to balance my checkbo...
How do you go about finding unused icons, images, strings in .resx files that may have become 'orphaned' and are no longer required?
Finding unused icons, images, and strings in `.resx` files involves a systematic approach to identify elements that are no longer referenced or needed in your application. Here’s a step-by-step method you can follow: ### 1. **Static Code Analysis** - **Automated Tools**: Use static code analysis tools that can scan...
28,238
[ { "from": "human", "value": "How do you go about finding unused icons, images, strings in .resx files that may have become 'orphaned' and are no longer required?\n" }, { "from": "gpt", "value": "Finding unused icons, images, and strings in `.resx` files involves a systematic approach to identify...
Are most flash video players created all programmatically? Or they done using static buttons that are referenced in classes? Is it better to create all your buttons on the fly or does it not really matter?
When it comes to creating flash video players, both methods—creating buttons programmatically and using static buttons—are common practices, and each has its advantages and disadvantages. ### Programmatic Creation of Buttons - **Advantages**: 1. **Dynamic Flexibility**: Buttons can be created at runtime, allowing fo...
32,333
[ { "from": "human", "value": "Are most flash video players created all programmatically? Or they done using static buttons that are referenced in classes? Is it better to create all your buttons on the fly or does it not really matter?\n" }, { "from": "gpt", "value": "When it comes to creating fl...
I'm playing around with BCEL. I'm not using it to generate bytecode, but instead I'm trying to inspect the structure of existing compiled classes. I need to be able to point to an arbitrary .class file anywhere on my hard drive and load a JavaClass object based on that. Ideally I'd like to avoid having to add the giv...
To inspect the structure of existing compiled Java classes using BCEL (Byte Code Engineering Library) without needing to add the class file to your classpath, you can directly create a `JavaClass` object from the `.class` file by using the `ClassParser` class that BCEL provides. This allows you to parse the class file ...
29,537
[ { "from": "human", "value": "I'm playing around with BCEL. I'm not using it to generate bytecode, but instead I'm trying to inspect the structure of existing compiled classes.\nI need to be able to point to an arbitrary .class file anywhere on my hard drive and load a JavaClass object based on that. Ideal...
I am unable to add .* at extension mapping in IIS (defaultwebsite -> properties -> home directory -> configuration) because it gives the message "Wrong file Extension". The operating system is Windows 2003 server. I can add .* at mapping in IIS when the operating system is Windows XP
In IIS on Windows Server 2003, the ability to add a mapping for `.*` directly through the IIS Manager is restricted due to security concerns and potential misconfigurations. However, you can still add a wildcard mapping by editing the `Metabase.xml` file directly or by using the command line. Here’s how you can do thi...
29,460
[ { "from": "human", "value": "I am unable to add .* at extension mapping in IIS (defaultwebsite -> properties -> home directory -> configuration) because it gives the message \"Wrong file Extension\". \nThe operating system is Windows 2003 server.\nI can add .* at mapping in IIS when the operating system is...
You get a compilation error if you define the string parameter to have a size greater than 8000 e.g. The size (9000) given to the type 'varchar' exceeds the maximum allowed for any data type (8000). Any ideas?
The error you are encountering indicates that you are trying to define a `varchar` parameter (or column) with a size larger than the maximum limit supported by SQL Server, which is 8000 characters for standard `varchar`. Here are a few suggestions to address this issue: 1. **Use `varchar(max)`**: If you need to store...
32,273
[ { "from": "human", "value": "You get a compilation error if you define the string parameter to have a size greater than 8000\ne.g. \nThe size (9000) given to the type 'varchar' exceeds the maximum allowed for any data type (8000).\n\nAny ideas?\n" }, { "from": "gpt", "value": "The error you are ...
Is it possible to get the client's DPI in a Partial Trust XBAP? If so, how?
In a Partial Trust XBAP (XAML Browser Application), it is generally not possible to directly access the client's DPI (dots per inch) setting due to the security restrictions imposed by the partial trust environment. XBAPs run in a sandboxed environment that limits their ability to access certain system-level informatio...
33,740
[ { "from": "human", "value": "Is it possible to get the client's DPI in a Partial Trust XBAP? If so, how?\n" }, { "from": "gpt", "value": "In a Partial Trust XBAP (XAML Browser Application), it is generally not possible to directly access the client's DPI (dots per inch) setting due to the secur...
I have an application in which most requests are submitted via AJAX, though some are submitted via "regular" HTTP requests. If a request is submitted and the user's session has timed out, the following JSON is returned: {"authentication":"required"} The JavaScript function which submits all AJAX requests handles this ...
Hi Don, It sounds like you're facing an interesting challenge with session management in your application. You're right in wanting to have a consistent user experience regardless of whether the request is an AJAX request or a regular HTTP request. Let's explore the second option you've outlined in more detail: ### ...
29,161
[ { "from": "human", "value": "I have an application in which most requests are submitted via AJAX, though some are submitted via \"regular\" HTTP requests. If a request is submitted and the user's session has timed out, the following JSON is returned:\n{\"authentication\":\"required\"}\n\nThe JavaScript func...
I am migrating some win forms panels to WPF. In WinForms, you can tab into to the combo box using the keyboard, select an item by typing the first character and then hit tab again and the combo to lose focus. In WPF the second tab will move the focus rectangle down the list, instead of moving onto the next control. Is ...
In WPF, the default behavior for combo boxes does differ from WinForms, especially when it comes to keyboard navigation and focus handling. To achieve the behavior you're looking for, you'll need to override some of the default keyboard handling. ### Customizing ComboBox Behavior You can handle the `PreviewKeyDown` e...
29,780
[ { "from": "human", "value": "I am migrating some win forms panels to WPF.\nIn WinForms, you can tab into to the combo box using the keyboard, select an item by typing the first character and then hit tab again and the combo to lose focus.\nIn WPF the second tab will move the focus rectangle down the list, i...
I would like to send some keystrokes from a C++ program into another window. For that reason I would like to have the user select the target window similar to how it is done in the Spy++ utility that comes with Visual Studio (drag a crosshair cursor over target window and have target window highlighted by a frame). How...
Implementing a window selection mechanism similar to Spy++ in a C++ application involves a few key concepts in the Windows API: handling mouse input, enumerating windows, and drawing a visual selection frame. Below is an outline of the approach you could take, along with some sample code snippets to guide you through t...
22,553
[ { "from": "human", "value": "I would like to send some keystrokes from a C++ program into another window.\nFor that reason I would like to have the user select the target window similar to how it is done in the Spy++ utility that comes with Visual Studio (drag a crosshair cursor over target window and have ...
In the default asp.net mvc project, in the Site.Master file, there is a menu navigation list: <div id="menucontainer"> <ul id="menu"> <li><%= Html.ActionLink("Home", "Index", "Home")%></li> <li><%= Html.ActionLink("About Us", "About", "Home")%></li> </ul> </div> This renders in th...
You're on the right track with your approach! To dynamically set the active class for your navigation items based on the current action and controller in an ASP.NET MVC project, you can leverage the `ViewContext` to retrieve the current route values. Here’s how you can implement this in your `Site.Master` file: 1. Y...
31,377
[ { "from": "human", "value": "In the default asp.net mvc project, in the Site.Master file, there is a menu navigation list:\n<div id=\"menucontainer\">\n <ul id=\"menu\"> \n <li><%= Html.ActionLink(\"Home\", \"Index\", \"Home\")%></li>\n <li><%= Html.ActionLink(\"About Us\", \"A...
I'm getting started on building a REST API for a project I'm working on, and it led me to do a little research as to the best way to build an API using RoR. I find out pretty quickly that by default, models are open to the world and can be called via URL by simply putting a ".xml" at the end of the URL and passing appr...
Building a REST API in Ruby on Rails (RoR) has indeed evolved over the years, and the best practices have shifted with newer versions of Rails and the introduction of various gems and middleware for authentication and authorization. While `attr_accessible` and `attr_protected` were used in older versions of Rails (pre-...
29,466
[ { "from": "human", "value": "I'm getting started on building a REST API for a project I'm working on, and it led me to do a little research as to the best way to build an API using RoR. I find out pretty quickly that by default, models are open to the world and can be called via URL by simply putting a \".x...
I have a class that contains a dynamically allocated array, say class A { int* myArray; A() { myArray = 0; } A(int size) { myArray = new int[size]; } ~A() { // Note that as per MikeB's helpful style critique, no need to check against 0. delete [] myArr...
The issue you're encountering arises from the way C++ handles object copying and assignment. When you create a new object of class `A` using `A(3)`, you are invoking the default copy constructor, which performs a shallow copy of the class. As a result, the dynamically allocated memory in the `myArray` member of the tem...
26,975
[ { "from": "human", "value": "I have a class that contains a dynamically allocated array, say\nclass A\n{\n int* myArray;\n A()\n {\n myArray = 0;\n }\n A(int size)\n {\n myArray = new int[size];\n }\n ~A()\n {\n // Note that as per MikeB's helpful style critiq...
i am writing a game in C++ and have a level consisting of many seperate meshes, each with their own vertex buffer. i am using vmmlib ( brilliant free gl compat. vector/matrix library ) to create my frustum culler and testing it against the bounding sphere of every mesh in the level. sadly my level can consist of up to ...
To optimize your frustum culling for a scene with a large number of meshes (like the 800 you mentioned), you can implement several techniques that reduce the number of meshes you need to check against the frustum each frame. Here are some strategies you can use: ### 1. **Spatial Partitioning:** - **Octrees or BSP T...
21,147
[ { "from": "human", "value": "i am writing a game in C++ and have a level consisting of many seperate meshes, each with their own vertex buffer. i am using vmmlib ( brilliant free gl compat. vector/matrix library ) to create my frustum culler and testing it against the bounding sphere of every mesh in the le...
When I compile an application with VS2008 I sometimes end up with 2 identical config files: *.exe.config *.vshost.exe.config What is the latter one for?
When you compile an application in Visual Studio 2008, you may notice that two configuration files are generated: `*.exe.config` and `*.vshost.exe.config`. ### Explanation of the Files: 1. **`*.exe.config`**: This is the standard configuration file for your application. It contains settings for your application, suc...
33,345
[ { "from": "human", "value": "When I compile an application with VS2008 I sometimes end up with 2 identical config files:\n\n*.exe.config\n*.vshost.exe.config\n\nWhat is the latter one for?\n" }, { "from": "gpt", "value": "When you compile an application in Visual Studio 2008, you may notice that...
How do I check if a field (textbox) is empty or filled only with white spaces (spaces/enters/tabs etc.), using javascript RegExp?
You can check if a textbox is empty or filled only with whitespace characters using a regular expression in JavaScript. Here's a simple example: ```javascript function isEmptyOrWhitespace(input) { // Regular expression to match empty string or strings that contain only whitespace characters const regex = /^\s*...
35,141
[ { "from": "human", "value": "How do I check if a field (textbox) is empty or filled only with white spaces (spaces/enters/tabs etc.), using javascript RegExp?\n" }, { "from": "gpt", "value": "You can check if a textbox is empty or filled only with whitespace characters using a regular expression...
How would I implement a binary search using just an array?
Implementing a binary search using an array in a programming language like Python is straightforward. Binary search operates on a sorted array and divides the search space in half each time, making it efficient. Here's a step-by-step explanation followed by code examples. ### Steps to Implement Binary Search 1. **Sor...
28,971
[ { "from": "human", "value": "How would I implement a binary search using just an array? \n" }, { "from": "gpt", "value": "Implementing a binary search using an array in a programming language like Python is straightforward. Binary search operates on a sorted array and divides the search space in...
I'm using Installshield 2008 express to create an installation package. My application relies on Sql Server 2005 express edition. I know I am able to check the "microsoft sql server 2005 express" prerequisite under the redistributables tab. However, this leaves the installation entirely in the hands of the end user, an...
To achieve a custom installation of SQL Server 2005 Express (for instance, using a named instance like "MyCompany") through InstallShield 2008 Express, you'll need to take a more hands-on approach since the Express version has limited capabilities when it comes to custom actions and prerequisites. Here’s how you can a...
30,574
[ { "from": "human", "value": "I'm using Installshield 2008 express to create an installation package. My application relies on Sql Server 2005 express edition. I know I am able to check the \"microsoft sql server 2005 express\" prerequisite under the redistributables tab. However, this leaves the installatio...
I'm pretty new to the whole MDX thing, but the following is just driving me batty. A FILTER statement I'm using is acting... strangely. Code sample, followed by description: SELECT { FILTER( MEMBERS([Time].[5-4-4 Week Year]), [Measures].[Ship Gross Units] > 0 ) } ON C...
It looks like you're running into an issue with how the `FILTER` function operates in your MDX query. When using the `FILTER` function, it's essential to understand how context works in MDX and how it relates to the measures being evaluated. ### Explanation of the Issue 1. **Context and Evaluation**: When you use `FI...
31,420
[ { "from": "human", "value": "I'm pretty new to the whole MDX thing, but the following is just driving me batty. A FILTER statement I'm using is acting... strangely. Code sample, followed by description:\nSELECT\n {\n FILTER(\n MEMBERS([Time].[5-4-4 Week Year]),\n [Measures].[...
I have been using win32api.MessageBox to do alerts, and this works for apps running from the interactive prompt and normally executed code, however when I built a Python service when a MessageBox is triggered I can hear the 'beep' but the box does not display. Is it possible to display alerts from services?
Displaying a MessageBox from a Windows service is generally not recommended and can lead to unexpected behavior. Services run in a different session than the user interface (UI) and, by default, do not have permission to interact with the user's desktop. This is why you're able to hear the beep but not see the message ...
29,432
[ { "from": "human", "value": "I have been using win32api.MessageBox to do alerts, and this works for apps running from the interactive prompt and normally executed code, however when I built a Python service when a MessageBox is triggered I can hear the 'beep' but the box does not display. Is it possible to...
I have two Slackware Linux systems on which the POSIX semaphore sem_open() call fails with errno set to 38. Sample code to reproduce below (the code works fine on CentOS / RedHat). Are there any kernel or system configuration options that could cause this? Other suggestions? Systems with issue are Slackware 10.1.0 kern...
The error you're encountering, with `errno` set to 38 (ENOSYS), indicates that the `sem_open()` function is not implemented on your Slackware system. This is an interesting case since you've already confirmed that POSIX semaphores are supposedly supported as indicated by `_POSIX_SEMAPHORES` being defined and `sysconf(_...
29,437
[ { "from": "human", "value": "I have two Slackware Linux systems on which the POSIX semaphore sem_open() call fails with errno set to 38. Sample code to reproduce below (the code works fine on CentOS / RedHat).\nAre there any kernel or system configuration options that could cause this? Other suggestions?\nS...
Is it possible to use a ".net configuration" file for a .NET console application? I'm looking for an equivalent to web.config, but specifically for console applications... I can certainly roll my own, but If I can use .NET's built in configuration reader then I would like to do that...I really just need to store a con...
Yes, you can use a configuration file in a .NET console application, although it is somewhat different from the `web.config` file used in ASP.NET applications. For .NET console applications, the equivalent is typically an `app.config` file (which gets renamed to `<YourExecutable>.exe.config` when you compile your appli...
30,129
[ { "from": "human", "value": "Is it possible to use a \".net configuration\" file for a .NET console application? \nI'm looking for an equivalent to web.config, but specifically for console applications...\nI can certainly roll my own, but If I can use .NET's built in configuration reader then I would like t...
I am trying to convert an access datetime field to a mysdl format, using the following string: select str_to_date('04/03/1974 12:21:22', '%Y %m %d %T'); While I do not get an error, I do not get the expected result, instead I get this: +---------------------------------------------------+ | str_to_date('04/03/1974 12:...
It looks like the issue with your `STR_TO_DATE` function is related to the format string you're using. The date in your Access database is formatted as `DD.MM.YYYY HH:MM:SS`, so you'll need to adjust your `STR_TO_DATE` call accordingly. Here is the correct SQL query to convert the date: ```sql SELECT STR_TO_DATE('06....
28,530
[ { "from": "human", "value": "I am trying to convert an access datetime field to a mysdl format, using the following string:\nselect str_to_date('04/03/1974 12:21:22', '%Y %m %d %T');\n\nWhile I do not get an error, I do not get the expected result, instead I get this:\n+-------------------------------------...
The 3-argument form of list::splice() moves a single element from one list to the other. SGI's documentation explicitly states that all iterators, including the one pointing to the element being moved remain valid. Roguewave's documentation does not say anything about iterator invalidation properties of splice() meth...
You are facing a classic case of differing behavior between STL implementations and the requirements set by the C++ standard. The key issue here is the validity of iterators when moving elements between lists. As you've noted, the C++ standard specifies that the `splice` operation invalidates all iterators and refere...
27,500
[ { "from": "human", "value": "The 3-argument form of list::splice() moves a single element from one list to the other. SGI's documentation explicitly states that all iterators, including the one pointing to the element being moved remain valid. Roguewave's documentation does not say anything about iterator...
Is there a platform-agnostic and filesystem-agnostic method to obtain the full path of the directory from where a program is running using C/C++? Not to be confused with the current working directory. (Please don't suggest libraries unless they're standard ones like clib or STL.) (If there's no platform/filesystem-agno...
In C/C++, obtaining the full path of the directory from where a program is running (i.e., the directory containing the executable) is not completely platform-agnostic. However, there are methods to achieve this on both Windows and Linux that utilize standard libraries (such as `<filesystem>` in C++17) but we can also u...
27,863
[ { "from": "human", "value": "Is there a platform-agnostic and filesystem-agnostic method to obtain the full path of the directory from where a program is running using C/C++? Not to be confused with the current working directory. (Please don't suggest libraries unless they're standard ones like clib or STL....
I cannot understand how this is possible. Please help!! I have an app with a trayicon. I want a form to be show when the user double clicks the trayicon. I have a problem where it is possible to get 2 or more forms showing by quickly triple or quadruple clicking the trayicon. The reason I don't want a singleton is tha...
To address your problem of multiple forms being created from rapid double-clicks on the tray icon, you can implement a few strategies that allow you to manage the form's lifecycle without needing a singleton. ### Solution Overview The main idea is to keep track of whether the form is in the process of being created o...
29,396
[ { "from": "human", "value": "I cannot understand how this is possible. Please help!!\nI have an app with a trayicon. I want a form to be show when the user double clicks the trayicon. I have a problem where it is possible to get 2 or more forms showing by quickly triple or quadruple clicking the trayicon. ...
We have an application that needs to know the path that it is executed from (which is always a network path). We set up part of our configuration based on the path that the application is launched from, and we really want that configuration to use mapped network drive paths instead of the UNC path to the resource. What...
When an application is run with elevated privileges (using UAC), it operates in a different security context. This means it can behave differently regarding network drives, especially mapped drives. Mapped drives are user-specific, so when you run the application elevated, it may not have access to the mapped drives of...
25,378
[ { "from": "human", "value": "We have an application that needs to know the path that it is executed from (which is always a network path).\nWe set up part of our configuration based on the path that the application is launched from, and we really want that configuration to use mapped network drive paths ins...
That was an interview question that I was unable to answer: How to check that a string is a palindrome using regular expressions? p.s. There is already a question "How to check if the given string is palindrome?" and it gives a lot of answers in different languages, but no answer that uses regular expressions.
Using regular expressions (regex) to check if a string is a palindrome can be quite challenging, as regex is generally not well-suited for checking properties that require backtracking or mirroring (like palindrome checking). However, it can be done in a clever way using regex in certain programming languages. Here’s...
29,277
[ { "from": "human", "value": "That was an interview question that I was unable to answer:\nHow to check that a string is a palindrome using regular expressions?\np.s. There is already a question \"How to check if the given string is palindrome?\" and it gives a lot of answers in different languages, but no a...
We have a makefile that is built last in our build process using Visual Studio to launch our unit tests. Unfortunately if the build fails the makefile is still processed and we have extra (annoying) errors. Any way to prevent that? Example Project A : build dummy.exe Project B (makefile) : build command is : run dummy....
To prevent the execution of your Makefile (Project B) when Project A has build errors in Visual Studio, you can leverage the concept of build dependencies and build events. Here’s a step-by-step guide on how to achieve this: ### Option 1: Use Project Dependencies 1. **Set Project Dependencies**: Ensure that Project ...
28,066
[ { "from": "human", "value": "We have a makefile that is built last in our build process using Visual Studio to launch our unit tests. Unfortunately if the build fails the makefile is still processed and we have extra (annoying) errors. Any way to prevent that?\nExample\nProject A : build dummy.exe\nProject ...
Basically the subject says it all: We have a couple of components running on Java 5, they're talking to each other via RMI. Should we expect any problems, if we move some of them to Java6? By moving I mean compiling them with -source/target 1.6 and running on a java6 vm.
When considering migrating components from Java 5 to Java 6 while maintaining RMI communication, there are several factors to keep in mind: 1. **Compatibility**: Java 6 is designed to be backward-compatible with Java 5. This means that in general, code compiled with Java 5 should run without issues on a Java 6 JVM. Ho...
31,756
[ { "from": "human", "value": "Basically the subject says it all: We have a couple of components running on Java 5, they're talking to each other via RMI. Should we expect any problems, if we move some of them to Java6? By moving I mean compiling them with -source/target 1.6 and running on a java6 vm.\n" },...
Is there any good resource (book, reference, web site, application...) which explains how to compute time complexity of an algorithm? Because, it is hard to make the things concrete in my mind. Sometimes it is talking about an iteration has time complexity of lg n; and then according to the another loop it becomes n.lg...
Understanding time complexity can be challenging at first, but there are many excellent resources that can help clarify these concepts with explanations and examples. Here are some recommendations: ### Books 1. **"Introduction to Algorithms" by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Ste...
26,960
[ { "from": "human", "value": "Is there any good resource (book, reference, web site, application...) which explains how to compute time complexity of an algorithm?\nBecause, it is hard to make the things concrete in my mind. Sometimes it is talking about an iteration has time complexity of lg n; and then acc...
In my asp.net mvc app I want to check if a certain url returns a valid response. Therefor I send the url to a method that tests the HttpWebRequest.GetResponse() On my dev server (vs2008) it works just fine. When deployed on production server however, it returns a Bad Request. The method is never hit and my asp.net cust...
There are several reasons you might be encountering a "Bad Request" error when trying to check a URL with `HttpWebRequest.GetResponse()` in your ASP.NET MVC application on a production server. Below are some possible causes and solutions: ### 1. **URL Format** Ensure that the URL you're testing is correctly formatted....
29,262
[ { "from": "human", "value": "In my asp.net mvc app I want to check if a certain url returns a valid response.\nTherefor I send the url to a method that tests the HttpWebRequest.GetResponse()\nOn my dev server (vs2008) it works just fine.\nWhen deployed on production server however, it returns a Bad Request....
I'm not a C++ developer, but I've always been interested in compilers, and I'm interested in tinkering with some of the GCC stuff (particularly LLVM). On Windows, GCC requires a POSIX-emulation layer (cygwin or MinGW) to run correctly. Why is that? I use lots of other software, written in C++ and cross-compiled for dif...
Your questions touch on some fundamental aspects of how compilers like GCC (GNU Compiler Collection) operate and how they interact with different operating system environments, particularly when it comes to Windows. ### Why GCC Needs a POSIX Emulation Layer on Windows 1. **System Calls and APIs**: GCC and many other ...
28,839
[ { "from": "human", "value": "I'm not a C++ developer, but I've always been interested in compilers, and I'm interested in tinkering with some of the GCC stuff (particularly LLVM).\nOn Windows, GCC requires a POSIX-emulation layer (cygwin or MinGW) to run correctly.\nWhy is that?\nI use lots of other softwar...
How would I specify a color in app.config and then convert that into an actual System.Drawing.Color object at runtime?
To specify a color in the `app.config` file and then convert it into a `System.Drawing.Color` object at runtime, you can follow these steps: 1. **Specify the Color in app.config**: You can add a configuration entry for the color in the `app.config` file using a key-value pair, where the value can be a string represent...
31,901
[ { "from": "human", "value": "How would I specify a color in app.config and then convert that into an actual System.Drawing.Color object at runtime?\n" }, { "from": "gpt", "value": "To specify a color in the `app.config` file and then convert it into a `System.Drawing.Color` object at runtime, yo...
Is there a reason to sort MultiMap in Java and how to do that?
In Java, a `MultiMap` is not a standard part of the Java Collections Framework, but the concept can be implemented using `Map<K, Collection<V>>`, where `K` is the key type and `V` is the value type. The reason to sort a `MultiMap` could vary based on your application needs, such as to have a consistent order when itera...
30,788
[ { "from": "human", "value": "Is there a reason to sort MultiMap in Java and how to do that?\n" }, { "from": "gpt", "value": "In Java, a `MultiMap` is not a standard part of the Java Collections Framework, but the concept can be implemented using `Map<K, Collection<V>>`, where `K` is the key type...
I read somewhere in the Microsoft documentation that the content of the ASP.NET's web.config is cached. If that is true, where is it cached - in memory or on disk? And a follow-up question: are there any performance considerations I have to make, if I have to access the web.config intensively?
Yes, the content of the `web.config` file in an ASP.NET application is cached in memory. When an ASP.NET application starts, it reads the `web.config` file, processes its settings, and caches the resulting configuration in memory. This means that subsequent accesses to configuration settings do not hit the disk; they r...
32,736
[ { "from": "human", "value": "I read somewhere in the Microsoft documentation that the content of the ASP.NET's web.config is cached. If that is true, where is it cached - in memory or on disk?\nAnd a follow-up question: are there any performance considerations I have to make, if I have to access the web.con...
What's the best way to store timezone information with dates/times in a uniform way so people can enter times from anywhere in the world in their own local time? Other users would then have the ability to view the times in their own local time and the original localtime on the web page.
Storing timezone information with dates and times in a uniform way is crucial for applications that involve users from multiple time zones. Here’s a general approach to handle this effectively: ### 1. Use UTC for Storage **Store all date and time values in Coordinated Universal Time (UTC):** - When a user inputs a da...
29,835
[ { "from": "human", "value": "What's the best way to store timezone information with dates/times in a uniform way so people can enter times from anywhere in the world in their own local time? Other users would then have the ability to view the times in their own local time and the original localtime on the ...
http://nexuscms.com/ Anybody use this CMS? i dont know much about it, need to index a site which was built using it with a GSA (google search appliance), but there is very little documentation about it on their website. wondering if there will be any pitfalls, what type of database does it use.. thanks.
NexusCMS is a content management system that is designed for building websites, but specific information about it can sometimes be hard to come by. Here are some points to consider when dealing with NexusCMS, especially if you're planning to index a site built with it using a Google Search Appliance (GSA): 1. **Databa...
32,479
[ { "from": "human", "value": "http://nexuscms.com/\nAnybody use this CMS? i dont know much about it, need to index a site which was built using it with a GSA (google search appliance), but there is very little documentation about it on their website.\nwondering if there will be any pitfalls, what type of dat...
I need to insert some data into a table in Oracle. The only problem is one of the fields is a timestamp(6) type and it is required data. I don't care about what actually goes in here I just need to get the right syntax for an entry so that the database will accept it. I'm using the gui web client to enter data however...
To insert data into a table in Oracle where one of the fields is of type `TIMESTAMP(6)`, you can use the `TO_TIMESTAMP` function to specify a timestamp value. The format should match your database's expected timestamp format, including fractions of a second since you are using `TIMESTAMP(6)`. Here's a general syntax f...
32,248
[ { "from": "human", "value": "I need to insert some data into a table in Oracle. \nThe only problem is one of the fields is a timestamp(6) type and it is required data. I don't care about what actually goes in here I just need to get the right syntax for an entry so that the database will accept it.\nI'm usi...
i dunno, but will your machine suffer great slowdown if you use a very complex regex? like for example the famous email validation module proposed just recently? which can be found here RFC822 update: sorry i had to ask this question in a hurry anyway i posted the link to the email regex i was talking about
Yes, using very complex regular expressions (regex) can lead to significant performance issues, especially if the regex is applied to large input strings or if the regex itself is not optimized. This slowdown can be attributed to several factors: 1. **Backtracking**: Some regex engines use backtracking to find matches...
32,599
[ { "from": "human", "value": "i dunno, but will your machine suffer great slowdown if you use a very complex regex?\nlike for example the famous email validation module proposed just recently? which can be found here RFC822\nupdate: sorry i had to ask this question in a hurry anyway i posted the link to the ...
I was looking at the Java code for LinkedList and noticed that it made use of a static nested class, Entry. public class LinkedList<E> ... { ... private static class Entry<E> { ... } } What is the reason for using a static nested class, rather than an normal inner class? The only reason I could think of, was that E...
You are correct that the term "static nested class" is the proper terminology in Java for a nested class that does not require an instance of the outer class to be created. Your reasoning about the encapsulation benefits and access to instance variables is indeed one of the main reasons for using a static nested class....
27,511
[ { "from": "human", "value": "I was looking at the Java code for LinkedList and noticed that it made use of a static nested class, Entry.\npublic class LinkedList<E> ... {\n...\n\n private static class Entry<E> { ... }\n\n}\n\nWhat is the reason for using a static nested class, rather than an normal inner cl...
How can I access options that I set in a jQuery Datepicker? $("#testDatePicker").datepicker({ minDate: new Date(2005, 0, 26), showOn: 'button', buttonImage: 'js/themes/default/images/calendar.gif', buttonImageOnly: true }); var minDate = $("#testDatePicker").?????;
To access options that you set in a jQuery Datepicker, you can use the `.datepicker("option", key)` method. This allows you to retrieve the value of a specific option that you set when initializing the Datepicker. In your case, if you want to access the `minDate` option, you would do it like this: ```javascript var m...
34,650
[ { "from": "human", "value": "How can I access options that I set in a jQuery Datepicker?\n$(\"#testDatePicker\").datepicker({\n minDate: new Date(2005, 0, 26),\n showOn: 'button',\n buttonImage: 'js/themes/default/images/calendar.gif',\n buttonImageOnly: true\n });\nvar minDate = $(\"#testDat...
Im trying to add more syntax elements for Zend Studio for eclipse. I want to change the color of the equal sign and it is not listed so I can change it.
In Zend Studio for Eclipse, customizing the syntax highlighting for elements like the equal sign can be a bit tricky, as it may not have a dedicated option for every specific element. However, there are ways to adjust the color settings for various syntax elements. Here's how you can change the syntax highlighting set...
32,451
[ { "from": "human", "value": "Im trying to add more syntax elements for Zend Studio for eclipse. I want to change the color of the equal sign and it is not listed so I can change it. \n" }, { "from": "gpt", "value": "In Zend Studio for Eclipse, customizing the syntax highlighting for elements lik...
Are there any tools you would recommend for site architecture design and analysis? I've checked out several such as Poseidon UML, Adalon and FuseBuilder for ColdFusion, Mindmapper and a few others but have yet to find anything that seems to strike the right balance between allowing for quick high-level planning (as ca...
There are several tools that can help with site architecture design and analysis, each with its own strengths and weaknesses. It sounds like you're looking for a balance between high-level planning and detailed architecture design. Here are some suggestions that might fit your needs: 1. **Lucidchart**: - A versatil...
31,081
[ { "from": "human", "value": "Are there any tools you would recommend for site architecture design and analysis? I've checked out several such as Poseidon UML, Adalon and FuseBuilder for ColdFusion, Mindmapper and a few others but have yet to find anything that seems to strike the right balance between allo...
We are trying to build a Crystal Report that sends control characters directly to the printer, without going through the (buggy) Windows driver for that printer. Does anyone know a way to do this from within a Crystal Report? The specific control character we are trying to send is CHR(2). However when we put that in a...
Sending control characters directly to a printer using Crystal Reports can be tricky, especially when dealing with specific printer drivers and environments like Citrix. Here are some suggestions and workarounds you can consider to achieve your goal of sending the control character CHR(2) directly to the printer withou...
32,145
[ { "from": "human", "value": "We are trying to build a Crystal Report that sends control characters directly to the printer, without going through the (buggy) Windows driver for that printer. Does anyone know a way to do this from within a Crystal Report? \nThe specific control character we are trying to sen...
I have a PHP app that needs to run bash scripts, and provide a username & password (for remote systems). I need to store these credentials somewhere that is accessible by my PHP (web) app. The logical place is the database (currently MySQL, but will be agnostic). The problem with the "standard" way of hashing and stori...
Storing sensitive credentials securely while ensuring that they can be retrieved in clear text for use in Bash scripts is a common challenge in application development. Here are some suggestions on how to approach this problem in a secure manner: ### 1. Use Encryption Encrypt the credentials before storing them in the...
27,627
[ { "from": "human", "value": "I have a PHP app that needs to run bash scripts, and provide a username & password (for remote systems).\nI need to store these credentials somewhere that is accessible by my PHP (web) app.\nThe logical place is the database (currently MySQL, but will be agnostic).\nThe problem ...
is there a difference in the dispose() functions being called ?
In programming, particularly in languages like Java, C#, and others that manage resources, `dispose()` is a method commonly associated with resource management. The `dispose()` function is often used to release resources that a program is no longer using, such as file handles, database connections, or graphic objects. ...
32,928
[ { "from": "human", "value": "is there a difference in the dispose() functions being called ?\n" }, { "from": "gpt", "value": "In programming, particularly in languages like Java, C#, and others that manage resources, `dispose()` is a method commonly associated with resource management. The `disp...
Besides the CODEX what resources do you recommend to help a person new to creating plugins help create a WordPress plugin. I have an idea, but need a bit better explanation than what is in the CODEX to get started. UPDATE: Is there a book that I could buy to help me out with this?
Creating a WordPress plugin can be a rewarding experience, and there are several resources beyond the WordPress Codex that can help you get started. Here are some recommended resources, including books, online tutorials, and other materials: ### Online Tutorials and Documentation 1. **WordPress Developer Handbook**: ...
24,813
[ { "from": "human", "value": "Besides the CODEX what resources do you recommend to help a person new to creating plugins help create a WordPress plugin. I have an idea, but need a bit better explanation than what is in the CODEX to get started.\nUPDATE: Is there a book that I could buy to help me out with th...
In the IDisposable.Dispose method is there a way to figure out if an exception is being thrown? using (MyWrapper wrapper = new MyWrapper()) { throw new Exception("Bad error."); } If an exception is thrown in the using statement I want to know about it when the IDisposable object is disposed.
In C#, the `IDisposable.Dispose` method does not have a built-in mechanism to directly know if an exception occurred during the use of a `using` statement. The `Dispose` method will be called regardless of whether an exception was thrown in the `using` block or not, but it does not receive information about the excepti...
34,030
[ { "from": "human", "value": "In the IDisposable.Dispose method is there a way to figure out if an exception is being thrown?\nusing (MyWrapper wrapper = new MyWrapper())\n{\n throw new Exception(\"Bad error.\");\n}\n\nIf an exception is thrown in the using statement I want to know about it when the IDisp...
How do you deal with a DateTime that should be able to contain an uninitialized value (equivalent to null)? I have a class which might have a DateTime property value set or not. I was thinking of initializing the property holder to DateTime.MinValue, which then could easily be checked. I've been searching a lot but cou...
In programming, handling a `DateTime` that can represent an "uninitialized" state (equivalent to null) can be addressed in a few different ways depending on the language you are using. Here are some common approaches: ### 1. Using Nullable Types (C#) If you're working with C#, you can utilize the nullable type featur...
30,426
[ { "from": "human", "value": "How do you deal with a DateTime that should be able to contain an uninitialized value (equivalent to null)?\nI have a class which might have a DateTime property value set or not. I was thinking of initializing the property holder to DateTime.MinValue, which then could easily be ...
I have developed a simple mechanism for my mvc website to pull in html via jquery which then populates a specified div. All is well and it looks cool. My problem is that i'm now creating html markup inside of my controller (Which is very easy to do in VB.net btw) I'd rather not mix up the sepparation of concerns. Is i...
Yes, you can definitely use an MVC View or a Partial View to achieve the behavior you're looking for, while still maintaining the separation of concerns in your application. Using Partial Views in ASP.NET MVC allows you to render a portion of a view (HTML markup) that can be populated with model data. Here's how you ca...
33,758
[ { "from": "human", "value": "I have developed a simple mechanism for my mvc website to pull in html via jquery which then populates a specified div. All is well and it looks cool.\nMy problem is that i'm now creating html markup inside of my controller (Which is very easy to do in VB.net btw) I'd rather no...
In IIS Manager under Web Service Extensions, ASP.NET v2.0.50727 is set to "Prohibited" by default. I would like to set this to Allow during the install. I am currently using WiX Version 2. I have tried using: <Component Id="Allow_WebServiceExtension_ASP.NET_2.0" DiskId="1" Guid="02247363-E423-41E1-AC15-BEF589B65A4D"> ...
To enable the existing "ASP.NET v2.0.50727" Web Service Extension in IIS using WiX, you need to modify the existing Web Service Extension rather than trying to add a new one. The key here is to ensure that your WiX installer correctly interacts with the existing configuration in IIS. Unfortunately, WiX version 2.x doe...
29,290
[ { "from": "human", "value": "In IIS Manager under Web Service Extensions, ASP.NET v2.0.50727 is set to \"Prohibited\" by default. I would like to set this to Allow during the install.\nI am currently using WiX Version 2.\nI have tried using:\n<Component Id=\"Allow_WebServiceExtension_ASP.NET_2.0\" DiskId=\...
In my view controller's -viewDidLoad method, I call [myTextField becomeFirstResponder]; This works like a charm, opens the keyboard and myTextField gets focus. I have a button with a target action (the action is in the same controller) that checks [myTextField isFirstReponder] - but it always returns false (er, NO in ...
In your scenario, it's likely that the `myTextField` is indeed becoming the first responder when you call `[myTextField becomeFirstResponder]` in `-viewDidLoad`, but by the time you check `[myTextField isFirstResponder]` in your button action, it may have lost focus for some reason. Here are a few things to consider ...
31,981
[ { "from": "human", "value": "In my view controller's -viewDidLoad method, I call [myTextField becomeFirstResponder]; This works like a charm, opens the keyboard and myTextField gets focus.\nI have a button with a target action (the action is in the same controller) that checks [myTextField isFirstReponder]...
I have created a custom action dll.I just want to check if a product with same name exists(Done).If yes tell the user to uninstall the product by throwing a InstallException.However if the products are installed in same directory the Install state of the prev product is removed & the install state of new product is cop...
To address the issue you're encountering with your custom action DLL during the installation of a new product when an existing product with the same name is already installed, there are several strategies you could implement: ### Strategies to Handle InstallException Properly 1. **Check Installed Products:** You a...
32,125
[ { "from": "human", "value": "I have created a custom action dll.I just want to check if a product with same name exists(Done).If yes tell the user to uninstall the product by throwing a InstallException.However if the products are installed in same directory the Install state of the prev product is removed ...
Anybody know how to get gmail's OpenID working? All I find is this http://openid-provider.appspot.com/, which gives 302 moved followed by GET not supported on this URL. I'm assuming this one is broken. Any others?
As of now, Google no longer supports OpenID for signing into services. They discontinued OpenID support in 2015 in favor of their own authentication protocols, primarily OAuth 2.0 and OpenID Connect. If you're looking to implement Google authentication in your application, the recommended approach is to use **Google S...
28,322
[ { "from": "human", "value": "Anybody know how to get gmail's OpenID working? All I find is this http://openid-provider.appspot.com/, which gives 302 moved followed by GET not supported on this URL.\nI'm assuming this one is broken. Any others?\n" }, { "from": "gpt", "value": "As of now, Google ...
WPF, Browserlike app. I got one page containing a ListView. After calling a PageFunction I add a line to the ListView, and want to scroll the new line into view: ListViewItem item = ItemContainerGenerator.ContainerFromIndex(index) as ListViewItem; if (item != null) ScrollIntoView(item); This works. As long as ...
In WPF, if you want to scroll a specific item in a `ListView` into view but that item is not currently visible (and hence does not have a corresponding `ListViewItem`), you can use the `ScrollIntoView` method on the `ListView` itself rather than on a specific `ListViewItem`. The `ListView` provides a method that can be...
32,490
[ { "from": "human", "value": "WPF, Browserlike app.\nI got one page containing a ListView. After calling a PageFunction I add a line to the ListView, and want to scroll the new line into view:\n ListViewItem item = ItemContainerGenerator.ContainerFromIndex(index) as ListViewItem;\n if (item != null)\n S...
I've just started playing with Django and am loosely following the tutorial with my own set of basic requirements. The models I've sketched out so far are a lot more comprehensive than the tutorial, but they compile fine. Otherwise, everything should have been the same. My problem is with the admin application. I can l...
Based on the information you provided, it looks like you are encountering a 404 error when trying to access the Django admin interface for your models. The error message mentions that it can't find the app `u''` and model `u'auth'`, which suggests there might be a misconfiguration in your application setup. Here are s...
26,278
[ { "from": "human", "value": "I've just started playing with Django and am loosely following the tutorial with my own set of basic requirements. The models I've sketched out so far are a lot more comprehensive than the tutorial, but they compile fine. Otherwise, everything should have been the same.\nMy prob...
I know you cannot use a alias column in the where clause for T-SQL; however, has Microsoft provided some kind of workaround for this? Related Questions: Unknown Column In Where Clause Can you use an alias in the WHERE clause in mysql? “Invalid column name” error on SQL statement from OpenQuery results
In T-SQL (Transact-SQL), you indeed cannot use an alias directly in the `WHERE` clause of the same query where that alias is defined, because the `WHERE` clause is evaluated before the `SELECT` clause in the SQL execution order. However, there are a few workarounds to achieve similar results. ### Workarounds 1. **Use...
27,364
[ { "from": "human", "value": "I know you cannot use a alias column in the where clause for T-SQL; however, has Microsoft provided some kind of workaround for this?\n\nRelated Questions: \n\nUnknown Column In Where Clause \nCan you use an alias in the WHERE clause in mysql? \n“Invalid column name” error on SQ...
I'm trying to migrate some DTS packages from SQL Server 2000 to 2008 to see how much pain is involved. I've got the Standard version of SQL Server 2008 installed on my local machine. I downloaded the Microsoft SQL Server 2000 DTS Designer Components and Microsoft SQL Server 2005 Backward Compatibility Components from...
Migrating DTS packages to SSIS in SQL Server 2008 can indeed be challenging, especially considering compatibility issues and differences between the two technologies. The specific error message you're encountering ("Attempted to read or write protected memory") suggests that there may be compatibility issues with your ...
27,696
[ { "from": "human", "value": "I'm trying to migrate some DTS packages from SQL Server 2000 to 2008 to see how much pain is involved. I've got the Standard version of SQL Server 2008 installed on my local machine.\nI downloaded the Microsoft SQL Server 2000 DTS Designer Components and Microsoft SQL Server 20...
I was reviewing some SQL queries and I saw a select statement that looked like this SELECT * FROM dbo.mytable WHERE (dbo.mytable.[Date] < { fn NOW() }) What is the purpose of using a WHERE statement like this? Wouldn't be easier to use a simple GETDATE()?
The SQL query you provided is using the `WHERE` clause to filter records in the `mytable` table based on the condition that the `Date` column contains values that are earlier than the current date and time. ### Purpose of the WHERE Clause 1. **Filtering Records**: The condition `dbo.mytable.[Date] < { fn NOW() }` is ...
32,957
[ { "from": "human", "value": "I was reviewing some SQL queries and I saw a select statement that looked like this \nSELECT *\nFROM dbo.mytable\nWHERE (dbo.mytable.[Date] < { fn NOW() })\n\nWhat is the purpose of using a WHERE statement like this?\nWouldn't be easier to use a simple GETDATE()?\n" }, { ...
We have a base object we use for some MVC-like system, where each property in a descendant is written like this: public String FirstName { get { return GetProperty<String>("FirstName", ref _FirstName); } set { SetProperty<String>("FirstName", ref _FirstName, value); } } This is done both for debugging purposes...
Creating a PostSharp aspect to automatically handle property getters and setters for an MVC-like system with change notifications and validation is a great idea. PostSharp allows you to write aspect-oriented programming (AOP) code that can encapsulate cross-cutting concerns. Here's a step-by-step approach to how you ...
26,244
[ { "from": "human", "value": "We have a base object we use for some MVC-like system, where each property in a descendant is written like this:\npublic String FirstName\n{\n get { return GetProperty<String>(\"FirstName\", ref _FirstName); }\n set { SetProperty<String>(\"FirstName\", ref _FirstName, valu...
Developing a website and just trying to get back into the swing of (clever) SQL queries etc, my mind had totally gone tonight! There is a website http://www.ufindus.com/ which has a textbox allowing you to enter either a place name or a postcode/zipcode. I am trying to do something similiar but I am rubbish at SQL - s...
To handle a situation where you want to query either a place name or a postcode based on user input, you can use a single SQL query that checks both conditions with a logical OR. Additionally, to improve the user experience, you may consider adding some simple logic to differentiate between a place name and a postcode ...
30,437
[ { "from": "human", "value": "Developing a website and just trying to get back into the swing of (clever) SQL queries etc, my mind had totally gone tonight!\nThere is a website http://www.ufindus.com/ which has a textbox allowing you to enter either a place name or a postcode/zipcode. I am trying to do some...