instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I need mysqldump including the data, but in database there are also couple of tables with FEDERATED engine. The mysqldump includes INSERTs for FEDERATED tables too, what makes for exemaple "Duplicate entry" errors (because the table is already filled with data). I can dump structure and data separately and then remove ...
When backing up MySQL databases that contain FEDERATED tables, the challenge arises because the `mysqldump` tool attempts to include INSERT statements for these tables, which can lead to "Duplicate entry" errors during restoration if the data already exists in the remote table. ### Backup Strategy Here’s a recommende...
40,928
[ { "from": "human", "value": "I need mysqldump including the data, but in database there are also couple of tables with FEDERATED engine. The mysqldump includes INSERTs for FEDERATED tables too, what makes for exemaple \"Duplicate entry\" errors (because the table is already filled with data).\nI can dump st...
I'm serializing class which contains DateTime property. public DateTime? Delivered { get; set; } After serializing Delivered node contains DateTime formatted like this: 2008-11-20T00:00:00 How can I change this property to make it look like this: 2008-11-20 00:00:00 Thanks in advance
To change the format of a `DateTime` property during serialization, you can use a custom `JsonConverter` if you are using JSON serialization with `System.Text.Json` or `Newtonsoft.Json` (Json.NET). Here’s how to achieve that with both libraries: ### Using Newtonsoft.Json If you are using Newtonsoft.Json, you can crea...
41,450
[ { "from": "human", "value": "I'm serializing class which contains DateTime property.\npublic DateTime? Delivered { get; set; }\n\nAfter serializing Delivered node contains DateTime formatted like this:\n2008-11-20T00:00:00\n\nHow can I change this property to make it look like this:\n2008-11-20 00:00:00\n\n...
I have a MySQL database that I want to archive. What is the best way to do this? Note: I don't want to just do a backup. I want to do a one time export of the data for long term storage in a way that I can get at on a later date. Particularly, I want to not be tied to MySQL, a database or preferably any given software ...
Your plan to use CSV for exporting your MySQL data is a good approach for long-term storage, especially since CSV is a widely-used format that can be easily read by many programming languages and tools. However, as you noted, there are specific considerations when dealing with BLOB columns, as they contain binary data ...
40,821
[ { "from": "human", "value": "I have a MySQL database that I want to archive. What is the best way to do this?\nNote: I don't want to just do a backup. I want to do a one time export of the data for long term storage in a way that I can get at on a later date. Particularly, I want to not be tied to MySQL, a ...
What is the best way to display a checkbox in a Crystal Report? Example: My report has a box for "Male" and "Female", and one should be checked. My current workaround is to draw a small graphical square, and line it up with a formula which goes like this: if {table.gender} = "M" then "X" else " " This is a poor solut...
In Crystal Reports, there are a few more straightforward methods to create checkboxes that can reduce the tediousness of your current workaround. Below are a couple of alternative approaches you might consider: ### 1. Use Conditional Formatting with Symbols Instead of manually drawing squares and aligning text, you ca...
39,166
[ { "from": "human", "value": "What is the best way to display a checkbox in a Crystal Report?\nExample: My report has a box for \"Male\" and \"Female\", and one should be checked.\nMy current workaround is to draw a small graphical square, and line it up with a formula which goes like this:\nif {table.gender...
I know the general consensus for information like shopping cart items is to store them in session. But what about objects that belong to a user that can be altered by other users? Say, for instance, an eBay-like site. If you store a user's "items" in session, which contain the current bid amount, and another user co...
In scenarios like an eBay-like site, where multiple users can interact with the same items (e.g., placing bids), managing the data correctly is crucial for a smooth user experience and data integrity. Storing user-related data in session has its pros and cons, especially in dynamic environments where data changes can o...
42,800
[ { "from": "human", "value": "I know the general consensus for information like shopping cart items is to store them in session. But what about objects that belong to a user that can be altered by other users? Say, for instance, an eBay-like site. If you store a user's \"items\" in session, which contain ...
The Daily WTF for 2008-11-28 pillories the following code: static char *nice_num(long n) { int neg = 0, d = 3; char *buffer = prtbuf; int bufsize = 20; if (n < 0) { neg = 1; n = -n; } buffer += bufsize; *--buffer = '\0'; do { *--buffer = '0' + (n % 10); ...
The provided code attempts to format a number with commas as thousands separators. However, it has several issues including potential buffer overflow, unclear buffer management, and reliance on a global variable `prtbuf`. Below is an improved version that addresses these concerns: 1. It uses a dynamically allocated bu...
42,725
[ { "from": "human", "value": "The Daily WTF for 2008-11-28 pillories the following code:\nstatic char *nice_num(long n)\n{\n int neg = 0, d = 3;\n char *buffer = prtbuf;\n int bufsize = 20;\n\n if (n < 0)\n {\n neg = 1;\n n = -n;\n }\n buffer += bufsize;\n *--buffer = '\...
I have an ASP.NET page that uses a repeater nested within another repeater to generate a listing of data. It's to the effect of the following: <asp:Repeater> <ItemTemplate> <span><%#Eval("Data1") %></span> <!-- and many more --> <asp:Repeater DataSource='<%#Eval("Data2")%>'> <Hea...
To handle the visibility of the nested repeater based on whether its data source is empty without modifying your existing code-behind too much, you can use the `ItemDataBound` event of the parent repeater. This allows you to check the data being bound to the nested repeater and conditionally set its visibility. Here’s...
42,634
[ { "from": "human", "value": "I have an ASP.NET page that uses a repeater nested within another repeater to generate a listing of data. It's to the effect of the following:\n<asp:Repeater>\n <ItemTemplate>\n <span><%#Eval(\"Data1\") %></span>\n <!-- and many more -->\n <asp:Repeater D...
I find AWK really useful. Here is a one liner I put together to manipulate data. ls | awk '{ print "awk " "'"'"'" " {print $1,$2,$3} " "'"'"'" " " $1 ".old_ext > " $1 ".new_ext" }' > file.csh I used this AWK to make a script file that would rename some files and only print out selective columns. Anyone know a ...
Your AWK one-liner is a creative way to generate a shell script for renaming files while selecting specific columns. However, there's usually a more straightforward approach to achieving such tasks using AWK directly without the need to create a separate script. Here are a few ideas and improvements: 1. **Direct Renam...
43,411
[ { "from": "human", "value": "I find AWK really useful. Here is a one liner I put together to manipulate data.\nls | awk '{ print \"awk \" \"'\"'\"'\" \" {print $1,$2,$3} \" \"'\"'\"'\" \" \" $1 \".old_ext > \" $1 \".new_ext\" }' > file.csh\n\nI used this AWK to make a script file that would rename so...
In some editors there exist plugins implementing a feature called "hungry backspace" or "hungry delete". If this mode is active in a text editor then one hit to the backspace key will automatically delete all whitespace chars backwards from the current cursor position up to the first non-whitespace character. For examp...
As of my last knowledge update in October 2023, Eclipse does not have a built-in "hungry backspace" or "hungry delete" feature like Emacs or IntelliJ IDEA. However, there are ways to achieve similar functionality by using plugins or custom key bindings. 1. **Plugins**: You can look for Eclipse plugins that might provi...
45,961
[ { "from": "human", "value": "In some editors there exist plugins implementing a feature called \"hungry backspace\" or \"hungry delete\".\nIf this mode is active in a text editor then one hit to the backspace key will automatically delete all whitespace chars backwards from the current cursor position up to...
Sorry for the bad title, but I couldn't think of a better one. I'm having a class A and a class B which is kind of a sub class of A, like so: (Is there actually a correct name for it? Isn't "sub class" reserved for inheritance?) class A { int i = 0; class B { int j = 1; } } class Test { public ...
You're tackling a couple of interesting questions regarding inner classes in Java. Let's break it down. ### Question 1: Retrieving the outer class instance from an inner class instance In Java, an inner class (like your `B` inside `A`) holds a reference to its enclosing outer class (which is `A`). Therefore, you can ...
40,515
[ { "from": "human", "value": "Sorry for the bad title, but I couldn't think of a better one.\nI'm having a class A and a class B which is kind of a sub class of A, like so:\n(Is there actually a correct name for it? Isn't \"sub class\" reserved for inheritance?)\nclass A {\n int i = 0;\n class B {\n ...
I run all my integers through a (int)Integer to make them safe to use in my query strings. I also run my strings through this function code:- if(!get_magic_quotes_gpc()) { $string = mysql_real_escape_string($string); } $pattern = array("\\'", "\\\"", "\\\\", "\\0"); $replace = array("", "", "", "");...
It's great that you're taking security seriously by sanitizing your inputs before using them in SQL queries. However, there are a few important points and best practices that you should consider regarding your current approach. ### 1. Handling Special Characters in MySQL While you are correct that the `%` character i...
40,459
[ { "from": "human", "value": "I run all my integers through a (int)Integer to make them safe to use in my query strings.\nI also run my strings through this function code:-\nif(!get_magic_quotes_gpc()) {\n $string = mysql_real_escape_string($string);\n }\n\n$pattern = array(\"\\\\'\", \"\\\\...
I'm trying to make an item on ToolBar (specifically a Label, TextBlock, or a TextBox) That will fill all available horizontal space. I've gotten the ToolBar itself to stretch out by taking it out of its ToolBarTray, but I can't figure out how to make items stretch. I tried setting Width to Percenatage or Star values, ...
To make an item (like a `Label`, `TextBlock`, or `TextBox`) within a `ToolBar` fill all available horizontal space, you have to manipulate the layout properties correctly since items in a `ToolBar` do not directly support percentage or star sizing in the same way that you might use in a `Grid`. Here's a common approa...
43,440
[ { "from": "human", "value": "I'm trying to make an item on ToolBar (specifically a Label, TextBlock, or a TextBox) That will fill all available horizontal space. I've gotten the ToolBar itself to stretch out by taking it out of its ToolBarTray, but I can't figure out how to make items stretch.\nI tried set...
My NHibernate configuration is set to show sql for all interactions. Because of this, some of my larger integration tests are performing poorly (particularly when generating the test report). Is there a way to turn off ShowSql at runtime - and then switch it back on programmatically.
Yes, you can dynamically adjust the `ShowSql` setting in NHibernate at runtime, although the process may not be as straightforward as simply toggling a property. Here's a general approach you can take: 1. **Modify the NHibernate Configuration**: Create a configuration setting for `ShowSql` in your NHibernate configura...
43,708
[ { "from": "human", "value": "My NHibernate configuration is set to show sql for all interactions. Because of this, some of my larger integration tests are performing poorly (particularly when generating the test report).\nIs there a way to turn off ShowSql at runtime - and then switch it back on programmati...
I created a way to dynamically add SettingsProperty to a .NET app.config file. It all works nicely, but when I am launching my app the next time I can only see the properties that are created in the designer. How can I load back the properties runtime? My code for creating the SettingsProperty looks like the following:...
When dynamically adding settings properties to a .NET application's configuration file (app.config), it’s important to understand how the settings are loaded and persisted across application runs. The default behavior is to only load settings that are defined at design time. Here are a few steps to ensure that your dyn...
24,395
[ { "from": "human", "value": "I created a way to dynamically add SettingsProperty to a .NET app.config file. It all works nicely, but when I am launching my app the next time I can only see the properties that are created in the designer. How can I load back the properties runtime?\nMy code for creating the ...
i created a register page n login page 4 members in php n mysql.and also i created a admin account and now i want to do something like if the member register he will be added only when the administrator approves it.please help
To implement a system where user registrations require administrator approval, you can follow these steps: 1. **Modify the Registration Process**: - Instead of activating the user immediately upon registration, add a new column in the user database table to indicate whether the user is approved or not (e.g., `is_ap...
40,707
[ { "from": "human", "value": "i created a register page n login page 4 members in php n mysql.and also i created a admin account and now i want to do something like if the member register he will be added only when the administrator approves it.please help\n" }, { "from": "gpt", "value": "To impl...
I've written a program that counts lines, words, and characters in a text: it does this with threads. It works great sometimes, but not so great other times. What ends up happening is the variables pointing to the number of words and characters counted sometimes come up short and sometimes don't. It seems to me that th...
Your issue likely stems from the fact that the main thread is finishing its execution and exiting before your spawned threads have a chance to complete their work. When you create a new thread in Java using `new Thread(...).start();`, that thread runs independently. If the main thread (the one running `countText()`) ex...
40,444
[ { "from": "human", "value": "I've written a program that counts lines, words, and characters in a text: it does this with threads. It works great sometimes, but not so great other times. What ends up happening is the variables pointing to the number of words and characters counted sometimes come up short an...
Is there a problem using VMware on Windows to host a virtual linux box running iptables? I have a configuration that seems to work on physical hardware but is flaky under VMware. I'm using VMware to run a virtual linux 2.6.24 machine on a Windows 2003 Server host. The linux application is essentially a NATting router...
Using VMware to run a Linux VM with iptables configured for NAT can introduce various complexities that might not be present in a physical environment. Here are several potential factors that might be contributing to the flaky behavior you're observing: 1. **Networking Mode**: Ensure that the networking mode of your V...
37,661
[ { "from": "human", "value": "Is there a problem using VMware on Windows to host a virtual linux box running iptables? I have a configuration that seems to work on physical hardware but is flaky under VMware.\nI'm using VMware to run a virtual linux 2.6.24 machine on a Windows 2003 Server host. The linux a...
I understand (I think) the basic idea behind RESTful-ness. Use HTTP methods semantically - GET gets, PUT puts, DELETE deletes, etc... Right? thought I understood the idea behind REST, but I think I'm confusing that with the details of an HTTP implementation. What is the driving idea behind rest, why is this becoming ...
You're on the right track in understanding REST (Representational State Transfer) and its principles! To clarify the driving ideas behind REST and its growing importance: ### Core Principles of REST 1. **Statelessness**: Each request from a client to server must contain all the information the server needs to underst...
41,976
[ { "from": "human", "value": "I understand (I think) the basic idea behind RESTful-ness. Use HTTP methods semantically - GET gets, PUT puts, DELETE deletes, etc... Right? thought I understood the idea behind REST, but I think I'm confusing that with the details of an HTTP implementation. What is the drivin...
I was looking through Mozilla's JS in JS code and came across the snarf function. It's not defined in the javascript, it seems, just in the C version here. It isn't very well-commented, though. I Google searched this to no avail. Is this a standard part of JavaScript? (My guess is no.) Is it some kind of extension? Wh...
The `snarf` function is not a standard part of JavaScript and is not a common feature in most JavaScript libraries or frameworks. It appears that you came across a function defined in the C version of JavaScript (specifically, in the SpiderMonkey engine, which is Mozilla's JavaScript engine). The purpose of the `snar...
45,681
[ { "from": "human", "value": "I was looking through Mozilla's JS in JS code and came across the snarf function. It's not defined in the javascript, it seems, just in the C version here. It isn't very well-commented, though. I Google searched this to no avail. \nIs this a standard part of JavaScript? (My gues...
There is a column in a database that is of type INT (Sql server). This int value is used at a bit flag, so I will be AND'ing and OR'ing on it. I have to pass a parameter into my sproc, and that parameter will represent a specific flag item. I would normally use an enumeration and pass the int representation to the spro...
Using a magic number or a string to represent flags in a stored procedure can lead to maintenance challenges, code readability issues, and potential errors. Instead, it might be better to consider the following strategies: ### 1. Use Constants or Definitions in the Database If you have control over the database schema...
41,182
[ { "from": "human", "value": "There is a column in a database that is of type INT (Sql server).\nThis int value is used at a bit flag, so I will be AND'ing and OR'ing on it.\nI have to pass a parameter into my sproc, and that parameter will represent a specific flag item.\nI would normally use an enumeration...
Is there a CPAN module that can read a string like this: "[[<asdf>, <foo>], (abc, def, ghi), ({'jkl'})]" ...and parse it into some sort of tree structure that's easy to walk and pretty-print?
Yes, you can use the `Parse::RecDescent` module from CPAN to parse complex strings like the one you've provided. This module allows you to define a grammar for parsing, and you can create a tree structure that represents the parsed data. However, if you are looking for a more straightforward solution to parse structu...
43,135
[ { "from": "human", "value": "Is there a CPAN module that can read a string like this:\n\"[[<asdf>, <foo>], (abc, def, ghi), ({'jkl'})]\"\n\n...and parse it into some sort of tree structure that's easy to walk and pretty-print?\n" }, { "from": "gpt", "value": "Yes, you can use the `Parse::RecDesc...
I have some low level serialization code that is templated, and I need to know the system's endianness at compiletime obviously (because the templates specializes based on the system's endianness). Right now I have a header with some platform defines, but I'd rather have someway to make assertions about endianness wi...
You can create a compile-time check for endianness using template specialization and the `static_assert` mechanism in C++. The key is to create a template that can test the byte order by examining the representation of a multi-byte type. Here's a simple way to do it using a union. This method does not rely on any vend...
41,809
[ { "from": "human", "value": "I have some low level serialization code that is templated, and I need to know the system's endianness at compiletime obviously (because the templates specializes based on the system's endianness). \nRight now I have a header with some platform defines, but I'd rather have some...
I'm starting to try and test my Doctrine objects with PHPUnit, and would like to reload the DB from my model objects afresh each time. My first attempt looks something like this: class Tests_User extends PHPUnit_Framework_TestCase { public function setUp() { Doctrine_Manager::connection('mysql://user:...
To properly set up and tear down your Doctrine database during PHPUnit tests, you need to ensure that the database is created and the tables are set up correctly before each test. Given your current implementation, you are encountering a problem because the tables are being created when they already exist. Here’s a mo...
40,572
[ { "from": "human", "value": "I'm starting to try and test my Doctrine objects with PHPUnit, and would like to reload the DB from my model objects afresh each time.\nMy first attempt looks something like this:\nclass Tests_User extends PHPUnit_Framework_TestCase\n{\n\n public function setUp()\n {\n\n ...
I am developing a small ASP.NET website for online shopping, when testing it out in Visual Studio, everything works fine, however that is no longer the case when I deploy it to IIS. The problem seems to be in a DLL file that I reference, this DLL file contains the Classes I need to initialize and send query requests to...
The issue you are encountering when transitioning from the Visual Studio development environment to IIS could stem from several factors. Since the error message indicates a `NullReferenceException`, it suggests that an object being used in your `Fulfiller` class isn't properly instantiated when running in IIS. Here are...
42,056
[ { "from": "human", "value": "I am developing a small ASP.NET website for online shopping, when testing it out in Visual Studio, everything works fine, however that is no longer the case when I deploy it to IIS.\nThe problem seems to be in a DLL file that I reference, this DLL file contains the Classes I nee...
I have a server with .Net 2.0 sp1 installed and have no ability to install the AJAX extensions on the server. Is there anyway I could work around this to incorporate ASP.NET AJAX functionality?
If you are unable to install the ASP.NET AJAX Extensions on a server with .NET 2.0 SP1, there are a few workarounds you might consider to incorporate AJAX functionality into your web application. Here are some approaches you could take: ### 1. Use jQuery or other JavaScript Libraries You can use client-side JavaScript...
40,207
[ { "from": "human", "value": "I have a server with .Net 2.0 sp1 installed and have no ability to install the AJAX extensions on the server. \nIs there anyway I could work around this to incorporate ASP.NET AJAX functionality?\n" }, { "from": "gpt", "value": "If you are unable to install the ASP...
Being fairly new to JavaScript, I'm unable to discern when to use each of these. Can anyone help clarify this for me?
Certainly! JavaScript has several concepts and structures, each suited for different use cases. Here are some key topics where beginners often have questions, along with clarifications for when to use them: ### 1. **Variables (var, let, const)** - **`var`**: Function-scoped or globally scoped. Avoid using `var` in ...
42,936
[ { "from": "human", "value": "Being fairly new to JavaScript, I'm unable to discern when to use each of these.\nCan anyone help clarify this for me?\n" }, { "from": "gpt", "value": "Certainly! JavaScript has several concepts and structures, each suited for different use cases. Here are some key t...
I have a user table in my mysql database that has a password column. Currently, I use the MD5 algorithm to hash the users' password for storage in the database. Now I like to think that I am a security conscience person. I noticed while reading the MySQL docs that they don't recommend MD5 or the SHA/SHA1 hashing method...
You're right to be concerned about the security of password storage, and moving away from MD5 is a wise decision. Both MD5 and SHA-1 have known vulnerabilities, and using them for password hashing is not secure. The best practice for hashing passwords involves using a strong, adaptive hashing algorithm designed specif...
40,153
[ { "from": "human", "value": "I have a user table in my mysql database that has a password column. Currently, I use the MD5 algorithm to hash the users' password for storage in the database. Now I like to think that I am a security conscience person. I noticed while reading the MySQL docs that they don't rec...
Use HttpWebRequest to download web pages without key sensitive issues
When using `HttpWebRequest` in C# to download web pages, there are a few best practices to follow to ensure that you handle sensitive information safely and avoid potential security issues. Here’s a simple example of how to do this effectively: ### Basic Example of Downloading a Web Page ```csharp using System; using...
42,410
[ { "from": "human", "value": "Use HttpWebRequest to download web pages without key sensitive issues\n" }, { "from": "gpt", "value": "When using `HttpWebRequest` in C# to download web pages, there are a few best practices to follow to ensure that you handle sensitive information safely and avoid p...
JCheckBox special = new JCheckBox ("\nSpecial - $17.95" + "\nMeatball, Sausage, Mushroom, Onion, Pepperoni & Pepper"); In this line of code, how do you make the checkbox make the "..." into two lines?
In a `JCheckBox`, to display text over multiple lines, you cannot directly use the newline character (`\n`) in the string. Instead, you can achieve multiline text by using HTML for the label. Here’s how you can modify your `JCheckBox` to display the text on two lines using HTML formatting: ```java JCheckBox special =...
47,671
[ { "from": "human", "value": "JCheckBox special = new JCheckBox (\"\\nSpecial - $17.95\" + \"\\nMeatball, Sausage, Mushroom, Onion, Pepperoni & Pepper\");\n\nIn this line of code, how do you make the checkbox make the \"...\" into two lines?\n" }, { "from": "gpt", "value": "In a `JCheckBox`, to d...
I'm writing a bit of code to display a bar (or line) graph in our software. Everything's going fine. The thing that's got me stumped is labeling the Y axis. The caller can tell me how finely they want the Y scale labeled, but I seem to be stuck on exactly what to label them in an "attractive" kind of way. I can't de...
Creating an attractive Y-axis scale for graphs can be a bit tricky, but there are some common techniques that can help you generate a visually appealing and useful set of labels based on your data. Here’s a general-purpose algorithm that you can follow: ### Step-by-step Algorithm 1. **Determine the Range of Data:** ...
41,519
[ { "from": "human", "value": "I'm writing a bit of code to display a bar (or line) graph in our software. Everything's going fine. The thing that's got me stumped is labeling the Y axis.\nThe caller can tell me how finely they want the Y scale labeled, but I seem to be stuck on exactly what to label them i...
I am trying to write my first real python function that does something real. What i want to accomplish is searching a given folder, and then open all images and merging them together so they make a filmstrip image. Imagine 5 images stacked on top of eachother in one image. I have this code now, which should be pretty m...
You're on the right track for creating a filmstrip image from a folder of images in Python. However, there are some important changes and improvements needed in your code: 1. **Correcting Imports:** You should import `glob` since you're using it to list files. Additionally, you might want to use `from PIL import Image...
40,159
[ { "from": "human", "value": "I am trying to write my first real python function that does something real. What i want to accomplish is searching a given folder, and then open all images and merging them together so they make a filmstrip image. Imagine 5 images stacked on top of eachother in one image.\nI ha...
This has always bugged me. When I ssh or telnet to a Unix server (whatever flavour) it always manages to guess correctly the terminal type I am logging in from and so the keyboard always acts 'normally' ... i.e. the backspace key works. But then when I have successfully logged in, it often guesses incorrectly the term...
This is a common issue that can occur when using SSH or Telnet to connect to a Unix server, and it usually stems from the way terminal types are detected and how terminal emulation works. ### Here are a few key points to consider: 1. **Terminal Type Detection**: - When you log in, your local terminal (the one from...
41,120
[ { "from": "human", "value": "This has always bugged me. When I ssh or telnet to a Unix server (whatever flavour) it always manages to guess correctly the terminal type I am logging in from and so the keyboard always acts 'normally' ... i.e. the backspace key works. \nBut then when I have successfully logged...
What's the best way to do it in .NET? I always forget what I need to Dispose() (or wrap with using). EDIT: after a long time using WebRequest, I found out about customizing WebClient. Much better.
In .NET, proper resource management is crucial to ensure that unmanaged resources are released promptly. This often means using the `IDisposable` interface and the `using` statement. Here are some general guidelines for determining what to `Dispose()` or wrap in a `using` statement: ### 1. Understand IDisposable Objec...
38,708
[ { "from": "human", "value": "What's the best way to do it in .NET?\nI always forget what I need to Dispose() (or wrap with using).\nEDIT: after a long time using WebRequest, I found out about customizing WebClient. Much better.\n" }, { "from": "gpt", "value": "In .NET, proper resource management...
I am curious to know how the Loader maps DLL into Process Address Space. How does the loader do that magic?
The loading of a Dynamic Link Library (DLL) into a process's address space is a complex operation, but it can be understood in a series of steps. This process is typically handled by the operating system's loader, which is responsible for preparing applications to run. Here's an overview of how the loader maps a DLL in...
42,010
[ { "from": "human", "value": "I am curious to know how the Loader maps DLL into Process Address Space. How does the loader do that magic?\n" }, { "from": "gpt", "value": "The loading of a Dynamic Link Library (DLL) into a process's address space is a complex operation, but it can be understood in...
I'm having an issue with expressions within reports. I'm coloring the background of a textbox within a table depending on the value within it. The text in the field relates to backups for a SQL Server. The value is either a date or the text "Not Yet Taken". If the date is more than 2 days old, I want the background...
The issue you're encountering is due to the way expressions are evaluated in SSRS. Even though you're using conditional logic, all the parts of the expression may still be evaluated, which leads to conversion errors when trying to convert a non-date string (like "Not Yet Taken") to a date. To resolve this, you need to...
39,690
[ { "from": "human", "value": "I'm having an issue with expressions within reports. I'm coloring the background of a textbox within a table depending on the value within it. The text in the field relates to backups for a SQL Server. The value is either a date or the text \"Not Yet Taken\". If the date is ...
I've got a bunch of legacy code that I need to write unit tests for. It uses pre-compiled headers everywhere so almost all .cpp files have a dependecy on stdafx.h which is making it difficult to break dependencies in order to write tests. My first instinct is to remove all these stdafx.h files which, for the most part,...
Removing all `stdafx.h` files from your legacy codebase can be a significant undertaking, especially if it's being heavily used throughout your project. While it may seem like an appealing solution, there are indeed alternative approaches you might consider before committing to such an extensive change. ### 1. **Using...
40,507
[ { "from": "human", "value": "I've got a bunch of legacy code that I need to write unit tests for. It uses pre-compiled headers everywhere so almost all .cpp files have a dependecy on stdafx.h which is making it difficult to break dependencies in order to write tests.\nMy first instinct is to remove all thes...
I'm using a custom tintColor on my UINavigationController's navigation bar, and because the color is so light I need to use dark colored text. It's relatively easy to swap out the title view, and the custom buttons I've added on the right hand side, but I can't seem to get a custom view to stick on the back button. Thi...
The issue you're encountering arises from the way `backBarButtonItem` works in `UINavigationItem`. The `backBarButtonItem` is used to display the back button's title when navigating back to a previous view controller, but it doesn't allow for custom views to be set directly. This means that even though you're creating ...
40,671
[ { "from": "human", "value": "I'm using a custom tintColor on my UINavigationController's navigation bar, and because the color is so light I need to use dark colored text. It's relatively easy to swap out the title view, and the custom buttons I've added on the right hand side, but I can't seem to get a cus...
Edit: How to return/serve a file from a python controller (back end) over a web server, with the file_name? as suggested by @JV
To serve a file from a Python backend using a web server, you typically use a web framework such as Flask or Django. Below are examples of how to serve a file using both Flask and Django. ### Using Flask 1. **Install Flask** if you haven't already: ```bash pip install Flask ``` 2. **Create a simple Flask ap...
42,805
[ { "from": "human", "value": "Edit: How to return/serve a file from a python controller (back end) over a web server, with the file_name? as suggested by @JV\n" }, { "from": "gpt", "value": "To serve a file from a Python backend using a web server, you typically use a web framework such as Flask ...
Is there a way using the iPhone SDK to get the same results as an HTTP POST or GET methods?
Yes, you can perform HTTP POST and GET requests in iOS apps using the iPhone SDK. The most common way to achieve this is by using the `URLSession` class, which is part of the Foundation framework. Here's how you can do both: ### GET Request Here’s a simple example of how to make a GET request using `URLSession`. ```...
37,726
[ { "from": "human", "value": "Is there a way using the iPhone SDK to get the same results as an HTTP POST or GET methods? \n" }, { "from": "gpt", "value": "Yes, you can perform HTTP POST and GET requests in iOS apps using the iPhone SDK. The most common way to achieve this is by using the `URLSes...
What Database Abstraction Layer libraries would you recommend for use with C++? I am more interested in solutions for non-Windows platforms, but that is personal preference. Which libraries would you recommend and why?
When it comes to database abstraction layer libraries for C++, there are several options that cater to various needs and preferences. Here’s a list of some popular libraries that work well on non-Windows platforms, along with their key features: 1. **SQLiteCpp**: - **Description**: A lightweight C++ wrapper around ...
42,506
[ { "from": "human", "value": "What Database Abstraction Layer libraries would you recommend for use with C++? I am more interested in solutions for non-Windows platforms, but that is personal preference. Which libraries would you recommend and why?\n" }, { "from": "gpt", "value": "When it comes t...
I got dtd in file and I cant remove it. When i try to parse it in Java I get "Caused by: java.net.SocketException: Network is unreachable: connect", because its remote dtd. can I disable somehow dtd checking?
Yes, you can disable DTD (Document Type Definition) validation when parsing XML in Java. Here’s how to do it using different XML parsing libraries: ### Using `DocumentBuilder` with `DocumentBuilderFactory` If you're using the standard Java XML parsing libraries (e.g., DOM), you can disable DTD validation by configuri...
43,363
[ { "from": "human", "value": "I got dtd in file and I cant remove it. When i try to parse it in Java I get \"Caused by: java.net.SocketException: Network is unreachable: connect\", because its remote dtd. can I disable somehow dtd checking?\n" }, { "from": "gpt", "value": "Yes, you can disable DT...
I am implementing a validation class in classic ASP. How should the validation class interface with my other classes? My current setup: The User class's set methods call the appropriate validation method in the validation class. Any errors that occur are stored in User.mError. For example, here's my set method for the...
Your current setup is functional but can be improved for better separation of concerns, reusability, and scalability. Here are a few suggestions on how to refactor your validation architecture in classic ASP: ### 1. Centralize Error Handling Instead of having an error member variable in every class, consider using a c...
39,980
[ { "from": "human", "value": "I am implementing a validation class in classic ASP. How should the validation class interface with my other classes? \nMy current setup:\nThe User class's set methods call the appropriate validation method in the validation class. Any errors that occur are stored in User.mError...
I've been developing business apps, basically CRUD, in ASP.Net for years now, and am interested in learning another language and platform. After a few trips to Borders and poking around a bit on the web, I have not found much dealing with generating reports in PHP. I can imagine, at least, how to generate Excel spread...
Hi Mike, Generating professional-looking reports in PHP can certainly be achieved through various libraries and tools. While PHP may not have a built-in reporting feature as robust as ASP.NET's offerings, there are several third-party libraries and solutions that can help you create high-quality reports, including the...
41,278
[ { "from": "human", "value": "I've been developing business apps, basically CRUD, in ASP.Net for years now, and am interested in learning another language and platform.\nAfter a few trips to Borders and poking around a bit on the web, I have not found much dealing with generating reports in PHP. I can imagi...
I was once given this task to do in an RDBMS: Given tables customer, order, orderlines and product. Everything done with the usual fields and relationships, with a comment memo field on the orderline table. For one customer retrieve a list of all products that customer has ever ordered with product name, year of first ...
It's understandable to feel overwhelmed when dealing with complex SQL queries, especially when combining data from multiple tables with various conditions. Let's address your points and explore potential solutions. ### 1. Complexity of SQL Queries SQL can sometimes become cumbersome when you need to perform complex ag...
41,437
[ { "from": "human", "value": "I was once given this task to do in an RDBMS:\nGiven tables customer, order, orderlines and product. Everything done with the usual fields and relationships, with a comment memo field on the orderline table.\nFor one customer retrieve a list of all products that customer has eve...
I'm working with an existing Java codebase which, while it can be invoked from an HTML page using an <APPLET> tag, does not actually subclass the Applet class. The same jars are also used in a non-browser context, so they did not subclass Applet. Now I need to communicate some values from Java back to the Javascript of...
In your situation, since your Java code does not subclass `Applet` and thus cannot use `JSObject`, you will need to find an alternative way to communicate back to the JavaScript on the invoking HTML page. Here are some approaches you can consider: ### 1. Using `JavaScript` as a bridge If your Java code can generate HT...
42,674
[ { "from": "human", "value": "I'm working with an existing Java codebase which, while it can be invoked from an HTML page using an <APPLET> tag, does not actually subclass the Applet class. The same jars are also used in a non-browser context, so they did not subclass Applet.\nNow I need to communicate some ...
I have configured my default page to be say "abcd.aspx" and is under ~/View//abcd.aspx and I have my javascripts under ~/Contents/Scripts/.js For some reason, only "../Content/Scripts/.js" works for including the js file on the page and "~/Contents/Scripts/.js" does not. This works only when i access the page with the ...
It seems like you're dealing with path resolution issues in your ASP.NET application. The difference between using `~/` and relative paths like `../` is significant, especially when dealing with default pages and URLs. ### Understanding Path Prefixes 1. **`~/`**: This is an ASP.NET special character that represents t...
39,820
[ { "from": "human", "value": "I have configured my default page to be say \"abcd.aspx\" and is under ~/View//abcd.aspx and I have my javascripts under ~/Contents/Scripts/.js\nFor some reason, only \"../Content/Scripts/.js\" works for including the js file on the page and \"~/Contents/Scripts/.js\" does not. ...
What is prefered way of setting html title (in head) for view when using master pages? One way is by using Page.Title in .aspx file, but that requires in master page which can mess with HTML code. So, lets assume no server side controls, only pure html. Any better ideas? UPDATE: I would like to set title in view NOT ...
When using master pages in ASP.NET Web Forms and you want to set the HTML title dynamically in your views (ASPX files) without relying on server-side controls or the `Page.Title` property, you can directly set the title in the `<head>` section of your ASPX file using a placeholder. Here’s a method to achieve this clean...
41,298
[ { "from": "human", "value": "What is prefered way of setting html title (in head) for view when using master pages?\nOne way is by using Page.Title in .aspx file, but that requires in master page which can mess with HTML code. So, lets assume no server side controls, only pure html. Any better ideas? \nUPD...
I got ahead of myself and downloaded and installed the OSX Python 2.6 package from www.python.org/download/ on my OSX 10.5.5 Intel Mac and installed the full package contents. Only after this did I come across http://wiki.python.org/moin/MacPython/Leopard stating that you should do a partial install of the package to a...
Installing Python 2.6 over the system Python on macOS, especially on older versions like OS X 10.5, can lead to issues, as the system Python is integrated into the operating system and used by various system applications and scripts. Here are some steps and considerations to help you deal with the situation: ### 1. **...
43,654
[ { "from": "human", "value": "I got ahead of myself and downloaded and installed the OSX Python 2.6 package from www.python.org/download/ on my OSX 10.5.5 Intel Mac and installed the full package contents. Only after this did I come across http://wiki.python.org/moin/MacPython/Leopard stating that you should...
Is there a way to know which file is being selected in windows explorer? I've been looking at the tutorial posted here Idiots guide to ... but the actions described are: hover context menu properties drag drag and drop I wonder if is there a method that get invoked when a file is selected. For instance to create a th...
In Windows Explorer, there's no direct method for programmatically detecting when a file is selected, as the Explorer itself does not expose any events for selection changes that can be hooked into. However, you can implement a few approaches to achieve similar functionality, especially if you want to create a thumbnai...
41,411
[ { "from": "human", "value": "Is there a way to know which file is being selected in windows explorer? I've been looking at the tutorial posted here Idiots guide to ... but the actions described are:\nhover\ncontext \nmenu properties \ndrag\ndrag and drop\nI wonder if is there a method that get invoked when ...
I'm writing some code that id like to be able to work with any window, such as a window created through the windows API, MFC, wxWidgets, etc. The problem is that for some things I need to use the same thread that created the window, which in many cases is just sat in a message loop. My first thought was to post a callb...
You're on the right track with using `RegisterWindowMessage`, which allows you to create a unique message identifier that won't conflict with standard messages or messages defined by other applications. Here's how you can effectively implement a callback mechanism in a way that works with any window, regardless of whet...
41,538
[ { "from": "human", "value": "I'm writing some code that id like to be able to work with any window, such as a window created through the windows API, MFC, wxWidgets, etc.\nThe problem is that for some things I need to use the same thread that created the window, which in many cases is just sat in a message ...
I am looking for the best way to make my desktop java program run in the background (daemon/service?) across most platforms (Windows, Mac OS, Linux [Ubuntu in particular]). By "best way" I am hoping to find a way that will: require a minimum amount of platform-specific code. not require the user to do anything a gene...
Running a Java desktop application as a background service or daemon on multiple platforms (Windows, macOS, and Linux) involves several considerations, especially to minimize platform-specific code and user interaction. Below are some strategies and best practices to achieve this: ### 1. Use a Cross-Platform Framework...
41,060
[ { "from": "human", "value": "I am looking for the best way to make my desktop java program run in the background (daemon/service?) across most platforms (Windows, Mac OS, Linux [Ubuntu in particular]).\nBy \"best way\" I am hoping to find a way that will:\n\nrequire a minimum amount of platform-specific cod...
How do Window's programmers profile their native C++ code? On Unix/Linux you have gprof [thanks Evan] & valgrind (I personally used this one, although it's not a real profiler), and recently I'm on Mac and Solaris, which means I moved to dTrace. Now when I've had the need to profile on Windows in the past, like at my p...
On Windows, there are several free tools that developers commonly use for profiling C++ applications. Here are some popular options: 1. **Visual Studio Profiler**: If you have access to Microsoft Visual Studio (even the Community Edition), it comes with built-in profiling tools. You can use the Performance Profiler to...
43,843
[ { "from": "human", "value": "How do Window's programmers profile their native C++ code?\nOn Unix/Linux you have gprof [thanks Evan] & valgrind (I personally used this one, although it's not a real profiler), and recently I'm on Mac and Solaris, which means I moved to dTrace. Now when I've had the need to pr...
I'm working with some code in C#.NET for an Internet Explorer extension that calls Javascript in the browser and gets the return value from the Javascript call. When the Javascript returns a primitive type or an array of primitive types, I get something that I can deal with, but when the Javascript returns an object, ...
When dealing with JavaScript in an Internet Explorer extension using C#.NET, the interaction between the two languages often results in some complexity, especially when JavaScript returns an object that you receive as a COM object. To handle these situations, you need to effectively work with the COM interop features a...
43,236
[ { "from": "human", "value": "I'm working with some code in C#.NET for an Internet Explorer extension that calls Javascript in the browser and gets the return value from the Javascript call. When the Javascript returns a primitive type or an array of primitive types, I get something that I can deal with, bu...
How do I check if a column exists in SQL Server 2000?
In SQL Server 2000, you can check if a column exists in a table by querying the `INFORMATION_SCHEMA.COLUMNS` view or the `sysobjects` and `syscolumns` system tables. ### Using `INFORMATION_SCHEMA.COLUMNS` You can use the following SQL query to check if a specific column exists in a particular table: ```sql SELECT * ...
44,776
[ { "from": "human", "value": "How do I check if a column exists in SQL Server 2000?\n" }, { "from": "gpt", "value": "In SQL Server 2000, you can check if a column exists in a table by querying the `INFORMATION_SCHEMA.COLUMNS` view or the `sysobjects` and `syscolumns` system tables.\n\n### Using `...
I need to move backwards through an array, so I have code like this: for (int i = myArray.Length - 1; i >= 0; i--) { // Do something myArray[i] = 42; } Is there a better way of doing this? Update: I was hoping that maybe C# had some built-in mechanism for this like: foreachbackwards (int i in myArray) { //...
In C#, there isn't a built-in `foreachbackwards` construct like you described. However, there are a few alternatives you could consider to make your code cleaner or more expressive while still achieving the goal of iterating backward through an array. ### Option 1: Use `Array.Reverse` You can reverse the array first i...
43,775
[ { "from": "human", "value": "I need to move backwards through an array, so I have code like this:\nfor (int i = myArray.Length - 1; i >= 0; i--)\n{\n // Do something\n myArray[i] = 42;\n}\n\nIs there a better way of doing this?\nUpdate: I was hoping that maybe C# had some built-in mechanism for this l...
For some reason, I am having trouble thinking of a good way to rewrite this function so it uses constant stack space. Most online discussions of tree recursion cheat by using the Fibonacci function and exploiting the properties of that particular problem. Does anyone have any ideas for this "real-world" (well, more rea...
To rewrite a recursive function that consumes a lot of stack space into one that uses constant stack space, we can utilize a technique known as tail recursion or implement an iterative approach using a trampoline (as you've mentioned Rich Hickey’s addition of an explicit trampoline function in Clojure). Since you are i...
39,666
[ { "from": "human", "value": "For some reason, I am having trouble thinking of a good way to rewrite this function so it uses constant stack space. Most online discussions of tree recursion cheat by using the Fibonacci function and exploiting the properties of that particular problem. Does anyone have any id...
jQuery selectors are wonderful, but I sometimes I find myself typing them over and over, and it gets a little annoying. $('#mybutton').click(function() { $('#message-box').doSomething(); $('#message-box').doSomethingElse(); $('#message-box').attr('something', 'something'); }); So often I like to cache my...
Using jQuery selectors efficiently can make your code cleaner and potentially improve performance. Let's break down the pros and cons of both patterns you've presented, as well as discuss memory concerns and selector cleanup. ### Pattern 1: Repeated Selectors ```javascript $('#mybutton').click(function() { $('#me...
41,204
[ { "from": "human", "value": "jQuery selectors are wonderful, but I sometimes I find myself typing them over and over, and it gets a little annoying.\n $('#mybutton').click(function() {\n $('#message-box').doSomething();\n $('#message-box').doSomethingElse();\n $('#message-box').attr('something', 's...
In graph theory, what is the distinction between minimal distance (which Dijkstra's algorithm finds), and minimal path (which I'm not sure what it is)?
In graph theory, the terms "minimal distance" and "minimal path" are related but refer to different concepts. 1. **Minimal Distance**: This typically refers to the shortest distance or weight between two vertices in a graph. In the context of Dijkstra's algorithm, which finds the shortest paths from a source vertex to...
45,037
[ { "from": "human", "value": "In graph theory, what is the distinction between minimal distance (which Dijkstra's algorithm finds), and minimal path (which I'm not sure what it is)?\n" }, { "from": "gpt", "value": "In graph theory, the terms \"minimal distance\" and \"minimal path\" are related b...
What rules apply to the name that ends up in the exports section of an PE (Portable Executable)? Roughly, I see names starting with an '_' underscore, a '?' question mark or an '@' at-sign. What do those mean, and what about the rest of the name? Also - How can I reverse the naming convention into something more usable...
In the context of Portable Executable (PE) files, which are the file format for executables in Windows, the names in the exports section follow certain conventions primarily influenced by the programming languages used to create the functions and their calling conventions. Below is an explanation of the conventions and...
43,379
[ { "from": "human", "value": "What rules apply to the name that ends up in the exports section of an PE (Portable Executable)?\nRoughly, I see names starting with an '_' underscore, a '?' question mark or an '@' at-sign. What do those mean, and what about the rest of the name?\nAlso - How can I reverse the n...
Thanks for a solution in C, now I would like to achieve this in C++ using std::sort and vector: typedef struct { double x; double y; double alfa; } pkt; vector< pkt > wektor; filled up using push_back(); compare function: int porownaj(const void *p_a, const void *p_b) { pkt *pkt_a = (pkt *) p_a; pkt *pkt_b =...
To use `std::sort` in C++, you need to provide a comparison function that matches the expected signature for the sorting mechanism. In C++, the comparison function should take two parameters of the type you are sorting and return a `bool` indicating whether the first parameter should come before the second. In your ca...
41,101
[ { "from": "human", "value": "Thanks for a solution in C,\nnow I would like to achieve this in C++ using std::sort and vector:\ntypedef struct\n{\n double x;\n double y;\n double alfa;\n} pkt;\n\nvector< pkt > wektor; filled up using push_back(); compare function:\nint porownaj(const void *p_a, const void...
I wanted to grep for java process and then find the max heap memory used. I tried this def ex =['sh','-c','ps -aef | grep Xmx'] String str = ex.execute().text while str has something like java -Xmx1024M /kv/classes/bebo/ -Xms512M How do I extract the value 1024M? I was planning to user java regex but thought someone ...
In Groovy, you can easily extract the maximum heap memory value using a combination of regular expressions and string manipulation. Here’s a step-by-step approach to achieve this: 1. Execute the command to get the Java processes. 2. Use a regular expression to match and extract the value of the `-Xmx` parameter. Here...
43,725
[ { "from": "human", "value": "I wanted to grep for java process and then find the max heap memory used.\nI tried this\ndef ex =['sh','-c','ps -aef | grep Xmx']\nString str = ex.execute().text\n\nwhile str has something like java -Xmx1024M /kv/classes/bebo/ -Xms512M\nHow do I extract the value 1024M? I was p...
This is related to a chapter from beautiful code. And in that chapter I read about the nested ifs. The author was talking about deeply nested ifs as originator of bugs and less readable. And he was talking about replacing nested ifs with case statements and decision tables. Can anybody illustrate how to remove nested ...
Certainly! Deeply nested `if` statements can lead to code that is hard to read, maintain, and understand, which is why it's often beneficial to replace them with clearer constructs like `switch` (or `case`) statements and decision tables. ### Example with Nested `if` Statements Let's say you have a nested `if` statem...
40,740
[ { "from": "human", "value": "This is related to a chapter from beautiful code.\nAnd in that chapter I read about the nested ifs.\nThe author was talking about deeply nested ifs as originator of bugs and less readable.\nAnd he was talking about replacing nested ifs with case statements and decision tables. \...
I found a code samples here: http://sturla.simnet.is/post/2008/09/22/Enable-proxy-in-IE.aspx But it's very complex and involves manipulating the Windows registry. Is there an easier and less error-prone way of changing the proxy server address?
Yes, there is a simpler and less error-prone way to change the proxy server settings in Internet Explorer (IE) without directly manipulating the Windows registry. You can use the built-in options in the Internet Options dialog or leverage a script with Windows PowerShell or VBScript if you need to automate the process....
42,029
[ { "from": "human", "value": "I found a code samples here:\nhttp://sturla.simnet.is/post/2008/09/22/Enable-proxy-in-IE.aspx\nBut it's very complex and involves manipulating the Windows registry.\nIs there an easier and less error-prone way of changing the proxy server address?\n" }, { "from": "gpt", ...
I was looking at the Python documentation and saw that there are 4-5 different versions of popen(), e.g. os.popen(), os.popen2(), etc. Apart from the fact that some include stderr while others don't, what are the differences between them and when would you use each one? The documentation didn't really explain it very ...
The `popen` functions in Python are used to open a new process and communicate with it via pipes. Here's a summary of the different `popen()` functions provided in the `os` module and when you might want to use each one: 1. **`os.popen(command, mode='r', buffering=-1)`**: - This function opens a pipe to or from the...
41,003
[ { "from": "human", "value": "I was looking at the Python documentation and saw that there are 4-5 different versions of popen(), e.g. os.popen(), os.popen2(), etc. \nApart from the fact that some include stderr while others don't, what are the differences between them and when would you use each one? The do...
Is there any reason that MVC isn't equally useful for desktop apps as for web apps? What would be required to make an ASP.NET MVC directory tree implementable as a desktop app?
The Model-View-Controller (MVC) architecture is a design pattern that is used widely in both web and desktop applications. However, there are some inherent differences in how MVC is implemented and utilized across these platforms due to their fundamental characteristics. ### Differences in MVC Usefulness Between Deskt...
41,914
[ { "from": "human", "value": "Is there any reason that MVC isn't equally useful for desktop apps as for web apps? \nWhat would be required to make an ASP.NET MVC directory tree implementable as a desktop app?\n" }, { "from": "gpt", "value": "The Model-View-Controller (MVC) architecture is a desi...
How do I programmatically embed a .Net module to the assembly generated by CodeDOM?
To programmatically embed a .NET module into an assembly generated by CodeDOM, you can use the `CodeDomProvider` to compile your code, and then use the `Assembly.Load` method to load the assembly and manipulate it with the `Mono.Cecil` library or similar tools to embed the module. Here’s a general step-by-step approac...
41,627
[ { "from": "human", "value": "How do I programmatically embed a .Net module to the assembly generated by CodeDOM?\n" }, { "from": "gpt", "value": "To programmatically embed a .NET module into an assembly generated by CodeDOM, you can use the `CodeDomProvider` to compile your code, and then use th...
I am trying to migrate my .net remoting code to wcf but I'm finding it difficult. Can someone help me migrate this simple Remoting based program below to use WCF? The program implements a simple publisher/subscriber pattern where we have a single TemperatureProviderProgram that publishers to many TemperatureSubcriberP...
Migrating your .NET Remoting code to WCF involves some changes in the way services and clients interact. WCF (Windows Communication Foundation) provides a more modern and flexible framework for building service-oriented applications, including support for different protocols and bindings. Here's how you can migrate yo...
37,287
[ { "from": "human", "value": "I am trying to migrate my .net remoting code to wcf but I'm finding it difficult. Can someone help me migrate this simple Remoting based program below to use WCF? The program implements a simple publisher/subscriber pattern where we have a single TemperatureProviderProgram that...
If a company often requires users to be created in a partner's active directory, and vice versa, does it make sense to set up a federated / trusted relationship between the AD instances? If so, what should be considered? Does the ACL for users in the partner AD still work the same way? What security risks does this exp...
Setting up a federated or trusted relationship between Active Directory (AD) instances can be a viable solution when there is a need for users from one AD to access resources in another AD. However, there are several considerations to take into account: ### Considerations for Setting Up a Federated/Trusted Relationshi...
41,260
[ { "from": "human", "value": "If a company often requires users to be created in a partner's active directory, and vice versa, does it make sense to set up a federated / trusted relationship between the AD instances? If so, what should be considered? Does the ACL for users in the partner AD still work the sa...
I need to add 30 minutes to values in a Oracle date column. I do this in my SELECT statement by specifying to_char(date_and_time + (.000694 * 31) which works fine most of the time. But not when the time is on the AM/PM border. For example, adding 30 minutes to 12:30 [which is PM] returns 1:00 which is AM. The answ...
In Oracle, when you want to add a duration (like 30 minutes) to a date, you can simply use the `INTERVAL` keyword or directly add the minutes as a fraction of a day. When using the `INTERVAL` keyword, you can specify the duration you want to add in a more clear and concise way. Here’s how you can do it: ```sql SELEC...
41,429
[ { "from": "human", "value": "I need to add 30 minutes to values in a Oracle date column. I do this in my SELECT statement by specifying \nto_char(date_and_time + (.000694 * 31)\nwhich works fine most of the time. But not when the time is on the AM/PM border. For example, adding 30 minutes to 12:30 [which...
I have a VB6 class with a method which raises an error: Public Sub DoSomething ... err.Raise 12345, description:="Error message" ... End Sub This method is called from a form: Public Sub ErrTest() On Error Goto err1 obj.DoSomething Exit Sub err1: MsgBox err.Description End Sub This works fine at runtime...
In Visual Basic 6 (VB6), error handling works differently at design time compared to runtime. When you raise an error within the IDE (design mode), the VB6 environment does not use your error handling routine. Instead, it presents its own error message dialog. This is by design, as the IDE needs to provide a way for yo...
41,734
[ { "from": "human", "value": "I have a VB6 class with a method which raises an error:\nPublic Sub DoSomething\n ...\n err.Raise 12345, description:=\"Error message\"\n ...\nEnd Sub\n\nThis method is called from a form:\nPublic Sub ErrTest()\n On Error Goto err1\n obj.DoSomething\n Exit Sub\nerr1:\n Ms...
I am trying to accomplish the following in MySQL (see pseudo code) SELECT DISTINCT gid FROM `gd` WHERE COUNT(*) > 10 ORDER BY lastupdated DESC Is there a way to do this without using a (SELECT...) in the WHERE clause because that would seem like a waste of resources.
To accomplish your goal of selecting distinct `gid` values from the `gd` table where the count of rows for each `gid` is greater than 10, you can use a combination of `GROUP BY` and `HAVING` clauses without a subquery in the `WHERE` clause. Here's how you can do it: ```sql SELECT gid FROM gd GROUP BY gid HAVING COUNT(...
44,949
[ { "from": "human", "value": "I am trying to accomplish the following in MySQL (see pseudo code)\nSELECT DISTINCT gid\nFROM `gd`\nWHERE COUNT(*) > 10\nORDER BY lastupdated DESC\n\nIs there a way to do this without using a (SELECT...) in the WHERE clause because that would seem like a waste of resources.\n" ...
how come this work public IQueryable<Category> getCategories(int postId) { subnusMVCRepository<Categories> categories = new subnusMVCRepository<Categories>(); subnusMVCRepository<Post_Category_Map> postCategoryMap = new subnusMVCRepository<Post_Category_Map>(); var query = from c in categories.G...
The code you provided seems to be for two similar methods that aim to fetch categories associated with a specific post. The difference between the two methods lies in the `where` clause, specifically how the `PostId` is being filtered: 1. **First Method**: The `where` clause is hardcoded to filter by `PostId == 1`. ...
40,446
[ { "from": "human", "value": "how come this work \npublic IQueryable<Category> getCategories(int postId) \n{\n subnusMVCRepository<Categories> categories = new subnusMVCRepository<Categories>();\n subnusMVCRepository<Post_Category_Map> postCategoryMap = new subnusMVCRepository<Post_Category_Map>...
If I select many rows from one table with one instance of DataContext. And then do I some changes in properties in the rows, can I submit changes to database only for one of the selected rows?
Yes, you can submit changes to the database for just one of the selected rows when using an instance of `DataContext` in LINQ to SQL or Entity Framework. When you make changes to the properties of the selected rows, you typically keep track of which rows you want to save changes to. Here's how you can do it: 1. **Se...
42,539
[ { "from": "human", "value": "If I select many rows from one table with one instance of DataContext.\nAnd then do I some changes in properties in the rows, can I submit changes to database only for one of the selected rows?\n" }, { "from": "gpt", "value": "Yes, you can submit changes to the datab...
Let me preface this by saying I don't care what language this solution gets written in as long as it runs on windows. My problem is this: there is a site that has data which is frequently updated that I would like to get at regular intervals for later reporting. The site requires JavaScript to work properly so just us...
To scrape a website that requires JavaScript, you'll need a solution that can render the page just like a browser does. One popular choice for this is using a headless browser. Here are a few approaches you can consider: ### 1. Using **Selenium** with Python Selenium is a powerful tool for controlling web browsers thr...
40,189
[ { "from": "human", "value": "Let me preface this by saying I don't care what language this solution gets written in as long as it runs on windows. \nMy problem is this: there is a site that has data which is frequently updated that I would like to get at regular intervals for later reporting. The site requi...
I am using the following method: set_browser_log_level 'off' but my log level continues to include INFOs. I am trying to suppress both logging and the "Last 4 commands" display for when my test enters a login password. http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/ruby/classes/Selenium/SeleniumDriver...
It seems you're using an older version of Selenium (0.9.2), which may have limitations in terms of log level configuration and handling sensitive information during tests. Since you mentioned that setting `set_browser_log_level 'off'` isn't working as expected, here are a few alternatives you can try: ### 1. Disable L...
42,832
[ { "from": "human", "value": "I am using the following method:\nset_browser_log_level 'off'\n\nbut my log level continues to include INFOs.\nI am trying to suppress both logging and the \"Last 4 commands\" display for when my test enters a login password.\nhttp://release.seleniumhq.org/selenium-remote-contro...
We are looking for a free solution to compress our SQL Server backups for SQL Server 2005. I am aware of SQL Safe freeware edition, but I was wondering what others thought of storing backup files in compressed folders to achieve the desired result. This would allow us to use the native SQL backup tasks and native win...
Using compressed folders to store SQL Server backups can be a viable solution for reducing the size of your backup files, especially when you're looking for a free option for SQL Server 2005. Here are some considerations to keep in mind: ### Pros of Using Compressed Folders: 1. **Cost-effective:** Utilizing built-in W...
44,654
[ { "from": "human", "value": "We are looking for a free solution to compress our SQL Server backups for SQL Server 2005. I am aware of SQL Safe freeware edition, but I was wondering what others thought of storing backup files in compressed folders to achieve the desired result. This would allow us to use t...
I used a query a few weeks ago in MySQL that described a table and suggested possible improvements to its structure. For example, if I have an int field but only the numbers 1-3 in that field, it will suggest set(1,2,3) as the type. I think I was using phpMyAdmin but I've been through all the functions I can find - Ana...
It sounds like you may have used a query that performs a "schema analysis" or "suggestions for improvements" based on the current data distribution within the table. Unfortunately, MySQL itself doesn't provide an out-of-the-box command for this specific kind of analysis. However, certain tools or custom queries might d...
45,887
[ { "from": "human", "value": "I used a query a few weeks ago in MySQL that described a table and suggested possible improvements to its structure. For example, if I have an int field but only the numbers 1-3 in that field, it will suggest set(1,2,3) as the type.\nI think I was using phpMyAdmin but I've been ...
I am maintaining an application that was written in Visual Basic 6.0 and makes use of the several OLE controls with Excel.Sheet.8 class objects. Several users are getting the following error when they reach a point in code that attempts to manipulate the excel objects. Run-time error '91': Object variable or With blo...
The `Run-time error '91': Object variable or With block variable not set` error in your Visual Basic 6.0 application typically indicates that you are trying to use an object variable that has not been properly initialized. In your case, the error is occurring when you attempt to set an object variable to an OLE object,...
42,928
[ { "from": "human", "value": "I am maintaining an application that was written in Visual Basic 6.0 and makes use of the several OLE controls with Excel.Sheet.8 class objects. Several users are getting the following error when they reach a point in code that attempts to manipulate the excel objects. \n\nRun-t...
This code is blunderous, as it adds a class to an array and later tries to pull it and manipulate it as if it were an object. private function fail(event:Event):void { var myObj:MyClass; var a:ArrayCollection = new ArrayCollection(); var x:MyClass; var y:MyClass; myObj = new MyClass; a.addItem(...
The line marked as `!!BAD!!` in your code is indeed problematic, but the reason it compiles without an error lies in how ActionScript handles types and reflection. When you write `a.addItem(MyClass);`, you are actually adding the `Class` type itself to the `ArrayCollection`, not an instance of `MyClass`. ActionScript...
43,546
[ { "from": "human", "value": "This code is blunderous, as it adds a class to an array and later tries to pull it and manipulate it as if it were an object.\nprivate function fail(event:Event):void\n{\n var myObj:MyClass;\n var a:ArrayCollection = new ArrayCollection();\n var x:MyClass;\n var y:My...
Is there an obvious way to do this that I'm missing? I'm just trying to make thumbnails.
Creating thumbnails can often be straightforward, but it depends on the tools you're using and your specific requirements. Here are some common methods for creating thumbnails: 1. **Image Editing Software**: Use software like Adobe Photoshop, GIMP, or Canva. You can open your image, resize it to the desired thumbnail ...
46,117
[ { "from": "human", "value": "Is there an obvious way to do this that I'm missing? I'm just trying to make thumbnails.\n" }, { "from": "gpt", "value": "Creating thumbnails can often be straightforward, but it depends on the tools you're using and your specific requirements. Here are some common ...
If I use inline functions, does the memory usage increase?
Inline functions can affect memory usage in different ways depending on how they are used and how the compiler optimizes the code. ### Inline Functions Overview An inline function is a suggestion to the compiler to replace a function call with the function's actual code, thereby potentially reducing the overhead of a...
41,871
[ { "from": "human", "value": "If I use inline functions, does the memory usage increase?\n" }, { "from": "gpt", "value": "Inline functions can affect memory usage in different ways depending on how they are used and how the compiler optimizes the code.\n\n### Inline Functions Overview\n\nAn inlin...
Is there a way to convert from System.Windows.Forms.HtmlElement to mshtml.IHTMLElemenet3? --edit after answer accepted -- This is what the code would look like. HtmlElement myElement = getElementByID(id); IHTMLElement3 h3 = (IHTMLElement3) myElement.DomElement; Thanks @korchev
Yes, you can convert from a `System.Windows.Forms.HtmlElement` to an `mshtml.IHTMLElement3`. The `HtmlElement` class provides a `DomElement` property that gives access to the underlying DOM element, which can be cast to the appropriate COM interface. Here’s how you can do the conversion: ```csharp using System.Window...
45,195
[ { "from": "human", "value": "Is there a way to convert from System.Windows.Forms.HtmlElement to mshtml.IHTMLElemenet3?\n--edit after answer accepted --\nThis is what the code would look like.\nHtmlElement myElement = getElementByID(id);\nIHTMLElement3 h3 = (IHTMLElement3) myElement.DomElement;\n\nThanks @ko...
thanks in advance for your help. I am wondering if there is a (design) pattern that can be applied to this problem. I am looking to parse, process, and extract out values from text files with similar, but differing formats. More specifically, I am building a processing engine that accepts Online Poker Hand History f...
Your problem is a classic case of needing to handle multiple formats of input data while applying the same processing logic on the extracted information. This can be effectively tackled using design patterns such as the **Strategy Pattern** along with the **Factory Pattern**. Here's how you could structure your solutio...
42,755
[ { "from": "human", "value": "thanks in advance for your help. I am wondering if there is a (design) pattern that can be applied to this problem. \nI am looking to parse, process, and extract out values from text files with similar, but differing formats.\nMore specifically, I am building a processing engi...
I am using the new ADO.NET Entity Data Model on a simple database. I have a table/entity with a primary key (PageID) and a ParentID foreign key that references back to itself on PageID for a parent/child "0..1 to many" relationship. On a ASP.Net page, I'm using a FormView with a asp:DynamicControl to express this as...
Hi Kelly, It sounds like you're dealing with a fairly common scenario when working with self-referencing tables in an entity framework. You're right that allowing an entity to reference itself as a parent can lead to logical inconsistencies in your hierarchical data structure. Here are a few possible approaches to han...
42,720
[ { "from": "human", "value": "I am using the new ADO.NET Entity Data Model on a simple database. I have a table/entity with a primary key (PageID) and a ParentID foreign key that references back to itself on PageID for a parent/child \"0..1 to many\" relationship. On a ASP.Net page, I'm using a FormView w...
I am currently in the process of rewriting an application whereby teachers can plan curriculum online. The application guides teachers through a process of creating a unit of work for their students. The tool is currently used in three states but we have plans to get much bigger than that. One of the major draw cards o...
Revising the data storage structure for student outcomes is essential for future scalability and ease of use. Given your constraints and considerations, let's explore the options and recommend a structured approach: ### Option 1: Continued Use of the Four-Table Structure This approach maintains your current structure ...
41,022
[ { "from": "human", "value": "I am currently in the process of rewriting an application whereby teachers can plan curriculum online.\nThe application guides teachers through a process of creating a unit of work for their students. The tool is currently used in three states but we have plans to get much bigge...
I am trying to convert a working MS Access query to run on an Oracle database being accessed via VB Script (.asp). This is the last section of the WHERE clause: sql = sql & "WHERE (UAT.HB.MB_MODE = 'A' AND UAT.HB.PRINT_DATE >= '" & SD & "' AND UAT.HB.PRINT_DATE <= '" & ED &"' )" The variable "SD" (i.e. "start dat...
When transitioning from MS Access to Oracle, there are a few important differences in how dates are handled. In Oracle, you don't use the `#` character as you do in Access. Instead, Oracle uses the `TO_DATE` function to explicitly convert a string to a date format. Given your `SD` and `ED` variables are in the format ...
44,914
[ { "from": "human", "value": "I am trying to convert a working MS Access query to run on an Oracle database being accessed via VB Script (.asp). This is the last section of the WHERE clause:\nsql = sql & \"WHERE (UAT.HB.MB_MODE = 'A' AND UAT.HB.PRINT_DATE >= '\" \n& SD & \"' AND UAT.HB.PRINT_DATE <= '\" & ...
In EL expressions, used in a jsp page, strings are taken literally. For example, in the following code snippet <c:when test="${myvar == 'prefix.*'}"> test does not evaluate to true if the value of myvar is 'prefixxxxx.' Does anyone know if there is a way to have the string interpreted as a regex instead? Does EL h...
In JSP Expression Language (EL), there is no built-in support for regular expressions like you find in languages such as JavaScript or programming languages like Perl or Python. EL is primarily designed for simple expressions and does not include regex capabilities. However, you can achieve similar functionality by us...
43,053
[ { "from": "human", "value": "In EL expressions, used in a jsp page, strings are taken literally. For example, in the following code snippet\n<c:when test=\"${myvar == 'prefix.*'}\">\n\ntest does not evaluate to true if the value of myvar is 'prefixxxxx.' Does anyone know if there is a way to have the str...
This may appear a newbie question but forgive me I am new to the world of dot Net. I have to make a desktop application that connects to a local SQL Server database. However in some cases the same database will be running on a server which can be accessed via the internet. What is the best way to design such a program....
Welcome to the world of .NET! Designing an application that can seamlessly work with both local and remote databases is a common scenario, and there are several approaches you can consider to make this work effectively. Here’s a high-level overview of a potential architecture and considerations for your application. #...
42,034
[ { "from": "human", "value": "This may appear a newbie question but forgive me I am new to the world of dot Net.\nI have to make a desktop application that connects to a local SQL Server database. However in some cases the same database will be running on a server which can be accessed via the internet.\nWha...
I have items wrapped in wrap panel. I want to move first line of items down by some offset. Is it possible? Thanks
In a `WrapPanel`, items are arranged in a flow layout, meaning that they wrap to the next line when they reach the edge of the panel. If you want to move the first line of items down by a specific offset, you can achieve this in a couple of ways depending on your use case. ### Option 1: Using Margins You can apply a m...
41,788
[ { "from": "human", "value": "I have items wrapped in wrap panel. \nI want to move first line of items down by some offset. \nIs it possible? \nThanks\n" }, { "from": "gpt", "value": "In a `WrapPanel`, items are arranged in a flow layout, meaning that they wrap to the next line when they reach th...
I have a couple of nagging compiler warnings for an app that I ported from VB6 a while back regarding CLS-Compliance including: Name '_AnIdentifier' is not CLS-Compliant. Type of parameter 'myType' is not CLS-Compliant. Despite this, my app seems to perform just fine from COM and Managed clients. I have seen several a...
The Common Language Specification (CLS) is a set of rules that defines a subset of features that are available across all .NET languages. If your code is not CLS-compliant, it can lead to a few practical issues, especially if you intend to expose your application to a wider audience or integrate with other .NET languag...
43,577
[ { "from": "human", "value": "I have a couple of nagging compiler warnings for an app that I ported from VB6 a while back regarding CLS-Compliance including:\nName '_AnIdentifier' is not CLS-Compliant.\nType of parameter 'myType' is not CLS-Compliant.\n\nDespite this, my app seems to perform just fine from C...
Does anyone know where I can find an example of how to determine if the Maximize and/or Minimize buttons on a window are available and/or disabled? The window will not be in the same process as my application. I have the hWnd and I have tried using GetMenuItemInfo, but I can't find any good samples for how to do this....
To determine the state of the Maximize and Minimize buttons on a window, you won't find that information through `GetMenuItemInfo`, as that function is used for menu items, not window buttons. Instead, you can use the `GetWindowLong` and `GetSystemMetrics` functions along with the window handle (hWnd) to check the stat...
42,421
[ { "from": "human", "value": "Does anyone know where I can find an example of how to determine if the Maximize and/or Minimize buttons on a window are available and/or disabled?\nThe window will not be in the same process as my application. I have the hWnd and I have tried using GetMenuItemInfo, but I can't...
Is there anything I should know before converting a large C++ program from VS2005 to VS2008?
When converting a large C++ program from Visual Studio 2005 (VS2005) to Visual Studio 2008 (VS2008), there are several things to keep in mind to ensure a smooth transition: 1. **Backward Compatibility**: Generally, VS2008 maintains good backward compatibility with VS2005 projects, but you should still make backups of ...
41,875
[ { "from": "human", "value": "Is there anything I should know before converting a large C++ program from VS2005 to VS2008?\n" }, { "from": "gpt", "value": "When converting a large C++ program from Visual Studio 2005 (VS2005) to Visual Studio 2008 (VS2008), there are several things to keep in mind...
I'm writing a ruby program that executes some external command-line utilities. How could I mock the filesystem from my rspec tests so that I could easily setup some file hierarchy and verify it after testing. It would also be best to be implemented in ram so that tests would run quickly. I realize that I may not find ...
To mock the filesystem in your Ruby tests using RSpec, you can use the `tmpfs` filesystem in Linux, which allows you to create a temporary file system in RAM. This way, you can create a mock file hierarchy that your tests can interact with. The `tmpfs` filesystem is particularly useful because it is fast and doesn't re...
40,014
[ { "from": "human", "value": "I'm writing a ruby program that executes some external command-line utilities. How could I mock the filesystem from my rspec tests so that I could easily setup some file hierarchy and verify it after testing. It would also be best to be implemented in ram so that tests would run...
I have a weird issue. I had a web service that was compiled under the 2.0 framework that was being consumed by a windows app that was compiled with the 1.1 framework. This worked just fine. Now, after upgrading the web service to the 3.5 framework, the windows app is no longer able to call it. Creating a little windows...
When you upgraded your web service to the .NET Framework 3.5, a few changes in the underlying protocol handling and security features may have affected its compatibility with your Windows app built with .NET Framework 1.1. Here are some steps to troubleshoot and potentially resolve the issue: 1. **Check for Protocol C...
40,259
[ { "from": "human", "value": "I have a weird issue. I had a web service that was compiled under the 2.0 framework that was being consumed by a windows app that was compiled with the 1.1 framework. This worked just fine. Now, after upgrading the web service to the 3.5 framework, the windows app is no longer a...
There's some object-oriented engineering principle that states something along the lines of "a class should only know about the contracts of the classes that it takes as arguments, or any internal ones it uses." The counter-example, in C++, is: Foo::bar( Baz* baz) { baz()->blargh()->pants()->soil(); // this is bad, ...
The principle you're referring to is often aligned with the **Dependency Inversion Principle (DIP)**, which is one of the SOLID principles of object-oriented design. Specifically, it emphasizes that high-level modules (like `Foo` in your example) should not depend on low-level modules (like `Baz` and its methods), but ...
42,824
[ { "from": "human", "value": "There's some object-oriented engineering principle that states something along the lines of \"a class should only know about the contracts of the classes that it takes as arguments, or any internal ones it uses.\"\nThe counter-example, in C++, is:\nFoo::bar( Baz* baz)\n{\n baz(...
Having recently gotten into test driven development I am using the Nunit test runner shipped as part of resharper. It has some downsides in terms of there is no shortcut to run tests and I have to go looking for the Nunit test runner to invoke it using the mouse. It has a nice GUI and shows the results as part of the I...
When it comes to running unit tests in .NET projects, there are several popular frameworks and tools that developers commonly use. Below are some of the most popular options along with their pros and cons: ### 1. **NUnit** - **Pros:** - Flexible and widely used unit testing framework. - Rich set of assert...
41,709
[ { "from": "human", "value": "Having recently gotten into test driven development I am using the Nunit test runner shipped as part of resharper. It has some downsides in terms of there is no shortcut to run tests and I have to go looking for the Nunit test runner to invoke it using the mouse. It has a nice G...
Well I'm new to OOP in PHP and am trying to write a site with it. The site is a basic flash games site and has categories to track the games. My first step was to create a basic MVC setup and list all the categories. The problem is I don't know how to create an array with all of the categories in it. Can I add this...
To create an array of all categories in your MVC setup for your PHP flash games site, you'll want to enhance your model by adding a method that retrieves all categories from the database. The controller can then use this method to fetch the categories and pass them to the view. Here's how you can implement this step-b...
40,625
[ { "from": "human", "value": "Well I'm new to OOP in PHP and am trying to write a site with it. The site is a basic flash games site and has categories to track the games. My first step was to create a basic MVC setup and list all the categories. The problem is I don't know how to create an array with all...
How do I sort the date and time in decending order in edit box?
To sort date and time in descending order in an edit box, you typically need to follow these steps: ### Step 1: Collect the Data Ensure that you have all the date and time entries stored in a suitable data structure. For example, you can use an array or a list. ### Step 2: Parse the Date and Time Make sure the dates ...
43,636
[ { "from": "human", "value": "How do I sort the date and time in decending order in edit box?\n" }, { "from": "gpt", "value": "To sort date and time in descending order in an edit box, you typically need to follow these steps:\n\n### Step 1: Collect the Data\nEnsure that you have all the date and...
I have an MSBuild task to build a specific project in a solution file. It looks something like this: <Target Name="Baz"> <MSBuild Projects="Foo.sln" Targets="bar:$(BuildCmd)" /> </Target> From the command line, I can set my BuildCmd to either Rebuild or Clean and it works as expected: msbuild /target:Baz /property:...
In MSBuild, the default behavior when no target is specified is to build the project. However, in your scenario, you are dynamically setting the target via the `BuildCmd` property in the MSBuild task. This means you need to specify a valid target to build your project without cleaning or rebuilding. To achieve a stand...
41,132
[ { "from": "human", "value": "I have an MSBuild task to build a specific project in a solution file. It looks something like this:\n<Target Name=\"Baz\">\n <MSBuild Projects=\"Foo.sln\" Targets=\"bar:$(BuildCmd)\" />\n</Target>\n\nFrom the command line, I can set my BuildCmd to either Rebuild or Clean and i...
I created a strongly typed LocationViewData with a properties like public Location location { get; set; } Location itself is model, with the properties Address, Country, and so on. In the controller I have: public ActionResult Edit(int id) { LocationViewData ld = new LocationViewData(); ... return View(ld)...
To make the properties of your `Location` model directly accessible in your view without needing to specify the full path each time, you can use the `Html.TextBoxFor` helper method. This method allows you to bind directly to the model properties, and it provides better support for model validation and binding. Here's ...
43,478
[ { "from": "human", "value": "I created a strongly typed LocationViewData with a properties like\npublic Location location { get; set; }\n\nLocation itself is model, with the properties Address, Country, and so on.\nIn the controller I have:\npublic ActionResult Edit(int id)\n{\n LocationViewData ld = new...