instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
In my admin view I would like several sub directories for example: admin/users/list.aspx I also have: admin/list.aspx What is the correct code to access admin/users/list.aspx from the controller? Or should the admin sub directories be at root level of View/ and then use routing?
In an ASP.NET MVC application, the approach to organize your views and controllers can vary based on your needs. However, it's generally advisable to follow certain conventions for better maintainability and clarity. ### Accessing Views from the Controller 1. **Using Subdirectories**: If you want to structure your vi...
32,712
[ { "from": "human", "value": "In my admin view I would like several sub directories for example:\nadmin/users/list.aspx\nI also have:\nadmin/list.aspx\nWhat is the correct code to access admin/users/list.aspx from the controller?\nOr should the admin sub directories be at root level of View/ and then use rou...
If I have a table like this: CREATE TABLE sizes ( name ENUM('small', 'medium', 'large') ); Is MySQL going to store those strings in every row, or internally will it use something smaller like integers to know which enum value to refer to? I want to use an enum in a table but I'm worried if it's as wasteful as stor...
In MySQL, when you use the `ENUM` data type, the values are stored internally as integers, which makes it more efficient than storing the strings directly. Specifically, MySQL will assign an integer value to each enumerated string. For example, in your table definition: ```sql CREATE TABLE sizes ( name ENUM('smal...
37,885
[ { "from": "human", "value": "If I have a table like this:\nCREATE TABLE sizes (\n name ENUM('small', 'medium', 'large')\n);\n\nIs MySQL going to store those strings in every row, or internally will it use something smaller like integers to know which enum value to refer to?\nI want to use an enum in a ta...
If you call a web service from Silverlight like this: MyServiceClient serviceClient = new MyServiceClient(); void MyMethod() { serviceClient.GetDataCompleted += new EventHandler<GetDataCompletedEventArgs>(serviceClient_GetDataCompleted); serviceClient.GetDataAsync(); // HOW DO I WAIT/JOIN HERE ON THE ASYNC CALL,...
In Silverlight, asynchronous operations are fundamentally designed to prevent blocking the UI thread, as doing so could freeze the user interface. Therefore, there's no direct way to "wait" or "join" on an asynchronous call in a manner similar to synchronous programming. However, you can refactor your code to handle th...
36,983
[ { "from": "human", "value": "If you call a web service from Silverlight like this:\nMyServiceClient serviceClient = new MyServiceClient();\nvoid MyMethod()\n{\n serviceClient.GetDataCompleted += new EventHandler<GetDataCompletedEventArgs>(serviceClient_GetDataCompleted);\n serviceClient.GetDataAsync();\n\...
Microsoft, of Cairo fame, is working on Oslo, a new modeling platform. Bob Muglia, Senior Vice President of Microsoft Server & Tools Business, states that the benefits of modeling have always been clear. In simple, practical terms, what are the clear benefits that Oslo bestows upon its users?
Oslo, Microsoft's modeling platform, offers several clear benefits to its users, particularly in the realm of software development and systems design. Here are some practical advantages: 1. **Visual Modeling**: Oslo provides a graphical interface for creating models, making it easier for users to visualize complex sys...
35,645
[ { "from": "human", "value": "Microsoft, of Cairo fame, is working on Oslo, a new modeling platform. Bob Muglia, Senior Vice President of Microsoft Server & Tools Business, states that the benefits of modeling have always been clear.\nIn simple, practical terms, what are the clear benefits that Oslo bestows ...
Assuming the following class stub: public class Foo<T> { private Class<T> type; public Foo<T> () {} } Can I store the generic type T into the field type in the constructor, without changing the constructor's signature to "public Foo<T> (Class<T> type)"? If yes, how? If no, why? "type = T" doesn't seem to work.
In Java, you cannot directly obtain the generic type parameter `T` at runtime because of type erasure. Type erasure is the process by which the Java compiler removes all generic type information during runtime. As a result, the type `T` becomes `Object` at runtime, and you lose the specific type information. In your c...
35,828
[ { "from": "human", "value": "Assuming the following class stub:\npublic class Foo<T> {\n private Class<T> type;\n\n public Foo<T> () {}\n}\n\nCan I store the generic type T into the field type in the constructor, without changing the constructor's signature to \"public Foo<T> (Class<T> type)\"? \nIf yes, ...
Are "out" parameters a bad thing in .NET? Any good articles/discussions on this topic?
The use of "out" parameters in .NET is a topic that generates a fair amount of discussion among developers. Here are some key points to consider: ### Pros of Using `out` Parameters: 1. **Multiple Return Values**: `out` parameters allow methods to return multiple values without the need to create a complex return type,...
36,135
[ { "from": "human", "value": "Are \"out\" parameters a bad thing in .NET? Any good articles/discussions on this topic?\n" }, { "from": "gpt", "value": "The use of \"out\" parameters in .NET is a topic that generates a fair amount of discussion among developers. Here are some key points to conside...
I have a label function like : private function formatDate (item:Object, column:DataGridColumn):String { var df:DateFormatter = new DateFormatter(); df.formatString = "MM/DD/YY"; if (column.dataField == "startDate") { return df.format(item.startDate); } return "ERR"; } Which I use in a da...
You can modify your `formatDate` function to be more generic by passing the field name as a parameter, allowing you to use the same function for different date fields. Instead of checking the `dataField` in the `column`, you can reference it dynamically. Here's how you can achieve this: 1. Add a parameter to your func...
36,822
[ { "from": "human", "value": "I have a label function like :\nprivate function formatDate (item:Object, column:DataGridColumn):String\n{\n var df:DateFormatter = new DateFormatter();\n df.formatString = \"MM/DD/YY\";\n\n if (column.dataField == \"startDate\") {\n return df.format(item.startDa...
We can see in a directory files ordered by Name in Windows Explorer. If I try the same thing in the Windows command prompt it orders by name differently - correctly: dir *.jpg /ON /B cubierta.jpg pag00.jpg pag06.jpg pag08.jpg pag09.jpg pag100.jpg pag101.jpg pag102.jpg pag103.jpg pag104.jpg pag105.jpg pag106.jpg pag107...
In Windows Command Prompt, the `dir` command does not have built-in functionality for natural sorting (also known as human-friendly sorting), which would order the numbers in a way that makes sense to a human. For example, it would consider "pag11.jpg" to come after "pag9.jpg" rather than after "pag100.jpg". To achiev...
37,391
[ { "from": "human", "value": "We can see in a directory files ordered by Name in Windows Explorer.\nIf I try the same thing in the Windows command prompt it orders by name differently - correctly:\ndir *.jpg /ON /B\n\ncubierta.jpg\npag00.jpg\npag06.jpg\npag08.jpg\npag09.jpg\npag100.jpg\npag101.jpg\npag102.jp...
I am coding a program that reads data directly from user input and was wondering how could I (without loops) read all data until EOF from standard input. I was considering using cin.get( input, '\0' ) but '\0' is not really the EOF character, that just reads until EOF or '\0', whichever comes first. Or is using loops t...
Reading all data from standard input until EOF without using loops can be a bit tricky, but there are a few approaches depending on the programming language you're using. If you're using C++, for instance, you can utilize standard library functions to read until EOF without explicitly writing a loop yourself. ### Meth...
30,012
[ { "from": "human", "value": "I am coding a program that reads data directly from user input and was wondering how could I (without loops) read all data until EOF from standard input. I was considering using cin.get( input, '\\0' ) but '\\0' is not really the EOF character, that just reads until EOF or '\\0'...
I am trying to format a date with: <fmt:formatDate value="${newsletter.createdOn}" pattern="MM/dd/yyyy"/> newsletter is an object with a createdOn property which is java.util.Date. When I invoke the previous sentence I get: According to the TLD, the attribute value does not accept expressions. I am importing fmt ...
The issue you're experiencing with `<fmt:formatDate>` is due to the fact that the `value` attribute expects a `java.util.Date` object but doesn't support EL (Expression Language) expressions in that attribute directly, as indicated in the error message. To work around this problem, you can use the `<c:set>` tag from t...
38,013
[ { "from": "human", "value": "I am trying to format a date with: \n<fmt:formatDate value=\"${newsletter.createdOn}\" pattern=\"MM/dd/yyyy\"/>\n\nnewsletter is an object with a createdOn property which is java.util.Date.\nWhen I invoke the previous sentence I get: \nAccording to the TLD, the attribute value d...
I have a web service in C# and would like to have a nested inner class, that abstracts away the session collection, something like this: public class Service : System.Web.Services.WebService { [WebMethod] public string Foo(string ticket) { SessionPool.getSession(ticket); } private class ...
In C#, nested classes do not have direct access to instance members of their enclosing class. In your case, the nested `SessionPool` class cannot access `Context.Session` directly since `Context` is not a static member of the `Service` class, and thus cannot be accessed from a static method in the nested class. To ach...
37,113
[ { "from": "human", "value": "I have a web service in C# and would like to have a nested inner class, that abstracts away the session collection, something like this: \n\n\npublic class Service : System.Web.Services.WebService\n{\n [WebMethod]\n public string Foo(string ticket)\n {\n SessionP...
Is there a way to link to a chm file, and therein to a certain topic, from a Microsoft Word docx document? Something in the lines of: "For more information about this Property see [link ref="./SomeDirectory/somedocument.chm!Sometopic.Somesubtopic" text="MyClass.MyProperty"]
Yes, you can link to a specific topic within a CHM (Compiled HTML Help) file from a Microsoft Word document. While the linking syntax you provided is not directly supported, you can achieve this by using the following method. ### Steps to Create a Link to a CHM File and a Specific Topic in Microsoft Word: 1. **Open M...
35,905
[ { "from": "human", "value": "Is there a way to link to a chm file, and therein to a certain topic, from a Microsoft Word docx document? Something in the lines of:\n\n\"For more information about this Property see [link ref=\"./SomeDirectory/somedocument.chm!Sometopic.Somesubtopic\" text=\"MyClass.MyProperty...
I have an ActiveRecord model, Foo, which has a name field. I'd like users to be able to search by name, but I'd like the search to ignore case and any accents. Thus, I'm also storing a canonical_name field against which to search: class Foo validates_presence_of :name before_validate :set_canonical_name priva...
To handle accent stripping and case normalization in a more elegant and efficient way, you can use the `UnicodeUtils` gem or the `I18n` module that comes with Rails. However, since you're looking to avoid complex regex and maintain readability, here’s how you can simplify your `canonicalize` method using the `I18n` mod...
37,362
[ { "from": "human", "value": "I have an ActiveRecord model, Foo, which has a name field. I'd like users to be able to search by name, but I'd like the search to ignore case and any accents. Thus, I'm also storing a canonical_name field against which to search:\nclass Foo\n validates_presence_of :name\n\n ...
How do I build an escape sequence string in hexadecimal notation. Example: string s = "\x1A"; // this will create the hex-value 1A or dec-value 26 I want to be able to build strings with hex-values between 00 to FF like this (in this example 1B) string s = "\x" + "1B"; // Unrecognized escape sequence Maybe there's a...
In C#, escape sequences need to be defined at compile time, which means you can't dynamically build escape sequences using string concatenation. However, you can achieve the same result using the `Convert` class or by using `Encoding` to convert byte values to a string. If you want to create a string from a hexadecima...
35,207
[ { "from": "human", "value": "How do I build an escape sequence string in hexadecimal notation. \nExample:\nstring s = \"\\x1A\"; // this will create the hex-value 1A or dec-value 26\n\nI want to be able to build strings with hex-values between 00 to FF like this (in this example 1B)\nstring s = \"\\x\" + \"...
C#: Could anyone give me good example on how anchoring controls at runtime is done?
In C#, anchoring controls at runtime can be accomplished by setting the `Anchor` property of the controls within a Windows Forms application. Anchoring allows you to specify how a control should be resized relative to its parent container when the container is resized. Here's an example of how to do this programmatic...
34,055
[ { "from": "human", "value": "C#: Could anyone give me good example on how anchoring controls at runtime is done?\n" }, { "from": "gpt", "value": "In C#, anchoring controls at runtime can be accomplished by setting the `Anchor` property of the controls within a Windows Forms application. Anchorin...
How can I generate a report in access with the data from a recordset (instead of a query or table). I have updates to the recordset that also must be shown in the report.
Generating a report in Microsoft Access from a recordset instead of directly from a query or table involves a few steps. Below, I'll outline a method using VBA (Visual Basic for Applications) to create a report based on a recordset with any updates you may need to include. This approach requires that you have some fami...
33,690
[ { "from": "human", "value": "How can I generate a report in access with the data from a recordset (instead of a query or table). I have updates to the recordset that also must be shown in the report.\n" }, { "from": "gpt", "value": "Generating a report in Microsoft Access from a recordset instea...
If I have 2 DataTables (dtOne and dtTwo) and I want to merge them and put them in another DataTable (dtAll). How can I do this in C#? I tried the Merge statement on the datatable, but this returns void. Does Merge preserve the data? For example, if I do: dtOne.Merge(dtTwo); Does dtOne change or does dtTwo change ...
In C#, the `DataTable.Merge` method is used to combine the contents of two `DataTable` objects. However, as you noted, `Merge` does not return a new `DataTable`; instead, it modifies the `DataTable` on which it is called. Therefore, when you execute `dtOne.Merge(dtTwo)`, it merges `dtTwo` into `dtOne`, and `dtOne` is c...
37,021
[ { "from": "human", "value": "If I have 2 DataTables (dtOne and dtTwo) and I want to merge them and put them in another DataTable (dtAll). How can I do this in C#? I tried the Merge statement on the datatable, but this returns void. Does Merge preserve the data? For example, if I do:\n dtOne.Merge(dtTwo)...
Just trying to understand Flickr's API setup, and how secure it really is. Flickr API Why do a MD5 hash and not something like AES?
The Flickr API, like many other APIs, utilizes various security measures to protect user data and ensure secure communication. However, the choice between using MD5 hashes and AES encryption serves different purposes, and it's important to understand their roles. ### MD5 Hashing 1. **Purpose**: MD5 (Message-Digest Al...
34,809
[ { "from": "human", "value": "Just trying to understand Flickr's API setup, and how secure it really is.\nFlickr API\nWhy do a MD5 hash and not something like AES?\n" }, { "from": "gpt", "value": "The Flickr API, like many other APIs, utilizes various security measures to protect user data and en...
This happens repeatedly and is very annoying. I upload some PHP code to a client's server. A few weeks pass. They ask for a change to be made and I re-download the code as they've made some changes. However, my code which used to be neat and tidy the last time I looked at it now has an extra lines of whitespace added e...
Yes, there are several tools and methods you can use to clean up PHP code and remove extra whitespace, ensuring your code remains neat and tidy. Here are some options: ### 1. **Text Editors with Code Formatting Features** Many text editors and IDEs have built-in features or plugins/extensions to format code, which can...
35,660
[ { "from": "human", "value": "This happens repeatedly and is very annoying. I upload some PHP code to a client's server. A few weeks pass. They ask for a change to be made and I re-download the code as they've made some changes. However, my code which used to be neat and tidy the last time I looked at it now...
I created following simple xml (C escape sequence used) "<A>\n</A>" When MSXML (v4 and v6) serialize DOM document using IXMLDOMDocument2.xml it changes newline to dos format and returns: "<A>\r\n</A>" instead. When I use DOM to retrieve only string node inside <A> element I get correct single character ("\n") string. O...
The behavior you're observing with MSXML (v4 and v6) when serializing a DOM document to XML format, where newline characters are converted from `\n` to the DOS format `\r\n`, is not necessarily a bug, but rather a consequence of how the MSXML library handles newline characters during serialization. ### Explanation 1....
36,723
[ { "from": "human", "value": "I created following simple xml (C escape sequence used) \"<A>\\n</A>\"\nWhen MSXML (v4 and v6) serialize DOM document using IXMLDOMDocument2.xml it changes newline to dos format and returns: \"<A>\\r\\n</A>\" instead.\nWhen I use DOM to retrieve only string node inside <A> eleme...
Hello can anybody solve this please I'm creating the object in the action class public CgUsers getUserdetail(){ CgUsers user = userManager.getUser(id); return user; } And I'm trying to use that object in the jsp page c:forEach items="${Userdetail}" var="user"> <ul> ...
The error message you're encountering indicates that JSP is unable to call the `getLastName()` method on the `user` object because it needs a prefix for the method call when a default namespace is not specified. In JSP, you generally access properties of objects using EL (Expression Language) notation rather than metho...
36,647
[ { "from": "human", "value": "Hello can anybody solve this please \nI'm creating the object in the action class \npublic CgUsers getUserdetail(){\n CgUsers user = userManager.getUser(id);\n return user;\n }\n\nAnd I'm trying to use that object in the jsp page \nc:forEach items=\"${Userde...
I was wondering how common it is to find genetic algorithm approaches in commercial code. It always seemed to me that some kinds of schedulers could benefit from a GA engine, as a supplement to the main algorithm.
Genetic algorithms (GAs) are a type of evolutionary algorithm that can be used to solve optimization problems and have been applied in various fields, including scheduling, design optimization, machine learning, and more. While their use in commercial code is not as ubiquitous as some traditional optimization technique...
35,753
[ { "from": "human", "value": "I was wondering how common it is to find genetic algorithm approaches in commercial code.\nIt always seemed to me that some kinds of schedulers could benefit from a GA engine, as a supplement to the main algorithm.\n" }, { "from": "gpt", "value": "Genetic algorithms ...
You can use XPath if you're binding the XML document in the XAML, but what if you're loading the XML document dynamically in the code behind? Is there any XPath methods available in the C# code behind? (using .NET 3.5 SP1)
Yes, in .NET, you can work with XML documents dynamically in the code-behind by using the `System.Xml` namespace, which provides classes for parsing and navigating XML documents. If you want to use XPath to query an XML document, you can use the `XPathDocument` and `XPathNavigator` classes. Here's an example of how to...
35,988
[ { "from": "human", "value": "You can use XPath if you're binding the XML document in the XAML, but what if you're loading the XML document dynamically in the code behind? Is there any XPath methods available in the C# code behind? \n(using .NET 3.5 SP1)\n" }, { "from": "gpt", "value": "Yes, in ....
Given a table named "person" (in a MySQL database/schema), kind of like this one: code varchar(25) lastname varchar(25) firstname varchar(25) I'm trying to make a stored function to receive "code" or a part of "code" (which of course, is the code that identifies that person) and return a 'list' of suggestions of...
Certainly! You can create a stored function in MySQL to search for persons based on the `code` using a `LIKE` clause. This function can take a `code` input and return a result set of matching persons. Here's a step-by-step guide to creating this stored function: ### Step 1: Create the Function You can create a store...
34,803
[ { "from": "human", "value": "Given a table named \"person\" (in a MySQL database/schema), kind of like this one:\ncode varchar(25) \nlastname varchar(25) \nfirstname varchar(25) \n\nI'm trying to make a stored function to receive \"code\" or a part of \"code\" (which of course, is the code that identifie...
Is a cfront tool available for the new C++? For any other modern languages?
Cfront was the original C++ compiler developed by Bjarne Stroustrup, which translated C++ code into C code. It was an early tool used to implement C++ but is now considered outdated. Cfront does not support the features of modern C++ (C++11 and beyond) as it was designed for an earlier version of the language. For mod...
36,420
[ { "from": "human", "value": "Is a cfront tool available for the new C++? For any other modern languages?\n" }, { "from": "gpt", "value": "Cfront was the original C++ compiler developed by Bjarne Stroustrup, which translated C++ code into C code. It was an early tool used to implement C++ but is ...
Related to the question asked here -- Default segment name in rails resources routing. Having trouble in edge rails trying to generate resources without a namespace prefix (i.e. /:apple_id/oranges/). Using the plugin gives me //:apple_id/oranges? Any easier way to do this? Maybe a 2.2 issue?
In Rails, when defining routes for nested resources, it's common to use a namespace or a scope to help organize your routes. However, if you're trying to define a nested resource route without a namespace prefix and running into issues, you can achieve your desired routing without the need for additional plugins. ### ...
35,621
[ { "from": "human", "value": "Related to the question asked here -- Default segment name in rails resources routing.\nHaving trouble in edge rails trying to generate resources without a namespace prefix (i.e. /:apple_id/oranges/). Using the plugin gives me //:apple_id/oranges?\nAny easier way to do this? M...
I was wondering if there is a way to implement an action listener for a Jbutton without a name. For example, I have the following for loop that creates a button for each letter of the alphabet. for (int i = 65; i < 91; i++){ alphabetPanel.add(new JButton("<html><center>" + (char)i)); } Is there a way that I can a...
Yes, you can certainly add an `ActionListener` to each JButton in your loop without hardcoding each button. You can achieve this by using an anonymous inner class or a lambda expression (if you are using Java 8 or later). Here’s how you can do it: ### Using an Anonymous Inner Class You can create the JButton and add ...
37,003
[ { "from": "human", "value": "I was wondering if there is a way to implement an action listener for a Jbutton without a name. For example, I have the following for loop that creates a button for each letter of the alphabet.\nfor (int i = 65; i < 91; i++){\n alphabetPanel.add(new JButton(\"<html><center>\...
I have an array of values that is passed to my function from a different part of the program that I need to store for later processing. Since I don't know how many times my function will be called before it is time to process the data, I need a dynamic storage structure, so I chose a std::vector. I don't want to have...
In C++, `std::vector` provides a convenient way to manage dynamic arrays, and it offers a straightforward way to copy elements from another array (or another `std::vector`) without needing to loop through each element individually. If you have an array (like a raw C-style array) or another vector that you want to copy...
35,087
[ { "from": "human", "value": "I have an array of values that is passed to my function from a different part of the program that I need to store for later processing. Since I don't know how many times my function will be called before it is time to process the data, I need a dynamic storage structure, so I c...
I'm using Emacs with C# Mode and when I turn on the speedbar, no files show up by default. I can choose "show all files" on the speedbar mode, but then every .cs file shows up with a '[?]' next to the name. How do I properly configure speedbar so it shows up with .cs files by default? How do I get the '[+]' next t...
To configure Speedbar in Emacs to show C# files (`.cs`) by default and allow for easy navigation within files, you will need to set up a few things in your Emacs configuration file (`init.el` or `.emacs`). Below are the steps to achieve this. 1. **Ensure that Speedbar recognizes `.cs` files**: By default, Speedbar may...
35,419
[ { "from": "human", "value": "I'm using Emacs with C# Mode and when I turn on the speedbar, no files show up by default. I can choose \"show all files\" on the speedbar mode, but then every .cs file shows up with a '[?]' next to the name. How do I properly configure speedbar so it shows up with .cs files...
I'm using a C# wrapper control similar to the WebBrowser control that contains the COM / unmanaged MSHTML control. I'm using this control in the edit mode which allows the user of the application to edit a a HTML document in a WYSIWYG manner. This control manages it's own undo / redo stack. How can I reset / clear it s...
To reset or clear the undo/redo stack in a COM-based HTML editing control (like the MSHTML control you're using in your C# wrapper), you'll typically need to interact with the `IHTMLDocument2` interface, which has methods for managing the undo/redo functionality. Here’s a general approach to reset the undo/redo stack:...
31,597
[ { "from": "human", "value": "I'm using a C# wrapper control similar to the WebBrowser control that contains the COM / unmanaged MSHTML control.\nI'm using this control in the edit mode which allows the user of the application to edit a a HTML document in a WYSIWYG manner.\nThis control manages it's own undo...
I have written an installation class that extends Installer and overrides afterInstall, but I'm getting a null pointer exception. How can I go about debugging my class?
Debugging a `NullPointerException` in your installation class can be approached methodically to identify the source of the issue. Here are the steps you can follow to help you debug your class effectively: ### 1. **Identify the Exception Source** First, ensure you check the stack trace of the `NullPointerException` to...
35,238
[ { "from": "human", "value": "I have written an installation class that extends Installer and overrides afterInstall, but I'm getting a null pointer exception. How can I go about debugging my class?\n" }, { "from": "gpt", "value": "Debugging a `NullPointerException` in your installation class ca...
I am using the FlexiGrid jQuery plug in and I need to get a JSON object back form my MVC App, simple enough if the FlexiGrid took just the object but I need to add a few items to the response string for it to work properly with FlexiGrid. So here is a portion of my controller code: If Request.QueryString("json") IsNot ...
It looks like you're trying to create a JSON response for the FlexiGrid using the `Json` method in your MVC application, but you are encountering an issue where `Json(objCustomerList)` is returning a `JsonResult` object instead of the JSON string that you need. To resolve this, you can serialize your object list to a ...
36,051
[ { "from": "human", "value": "I am using the FlexiGrid jQuery plug in and I need to get a JSON object back form my MVC App, simple enough if the FlexiGrid took just the object but I need to add a few items to the response string for it to work properly with FlexiGrid.\nSo here is a portion of my controller c...
I have to define the grammar of a file like the one shown below. //Sample file NameCount = 4 Name = a Name = b Name = c Name = d //End of file Now I am able to define tokens for NameCount and Name. But i have to define the file structure including the valid number of instances of token Name , which is the value after N...
To define a grammar that enforces the repetition of the `Name` token exactly `nc` times, you can use the following approaches depending on the parsing library or framework you're using. Below is an example using ANTLR (a popular parser generator), but similar concepts can be applied in other parsing frameworks. ### Ex...
35,673
[ { "from": "human", "value": "I have to define the grammar of a file like the one shown below.\n//Sample file\nNameCount = 4\nName = a\nName = b\nName = c\nName = d\n//End of file\nNow I am able to define tokens for NameCount and Name. But i have to define the file structure including the valid number of ins...
Under visual studio if you run a web project by pressing the Go button on the Debugging toolbar, then stop it by pressing the Stop button on the debugging toolbar, Internet Explorer is opened and closed by the IDE. Is there a way to prevent the IDE from closing Internet Explorer when stopping debugging? I want to do th...
In Visual Studio, when you run a web project and then stop debugging, it typically closes the browser that was opened during the debugging session. However, if you want to prevent Internet Explorer from closing when you stop debugging, you can use a couple of workarounds. ### Workaround 1: Change the Browser Configura...
36,134
[ { "from": "human", "value": "Under visual studio if you run a web project by pressing the Go button on the Debugging toolbar, then stop it by pressing the Stop button on the debugging toolbar, Internet Explorer is opened and closed by the IDE.\nIs there a way to prevent the IDE from closing Internet Explore...
I'm sure this must be possible, but I can't find out how to do it. Any clues?
Of course! I'd be happy to help. However, I need a bit more context to provide you with the best clues or guidance. Could you please specify what you're trying to accomplish or the area you're having trouble with?
38,607
[ { "from": "human", "value": "I'm sure this must be possible, but I can't find out how to do it.\nAny clues?\n" }, { "from": "gpt", "value": "Of course! I'd be happy to help. However, I need a bit more context to provide you with the best clues or guidance. Could you please specify what you're tr...
I am using the MYSQL C API and I have a MYSQL_ROW object that I would like to convert to a string. Does anyone know how to do this? I haven't found anything in the API's doc yet. string str = (string)row[0] <-- runtime error P.S. I tried casting it to a string but it doesn't work
In MySQL C API, a `MYSQL_ROW` is essentially a pointer to an array of strings, where each string corresponds to a column in the result set. Each element in the `MYSQL_ROW` is of type `char*`, and it represents the column value as a C-style string. To convert a specific column value from the `MYSQL_ROW` to a C++ `std:...
37,675
[ { "from": "human", "value": "I am using the MYSQL C API and I have a MYSQL_ROW object that I would like to convert to a string. Does anyone know how to do this? I haven't found anything in the API's doc yet.\nstring str = (string)row[0] <-- runtime error\nP.S. I tried casting it to a string but it doesn't ...
In our database, we have a system set up to keep track of applications. We have a bool column that indicates whether or not the application is approved. Then there's another column that indicates whether or not the application is denied. If neither column is true, then the application is considered to be pending. Is...
Yes, you can definitely merge those columns into a single value in a SQL view without the need for a Table-valued function. You can use a `CASE` statement to evaluate the boolean columns and return the appropriate string value ("approved", "denied", or "pending"). Here's an example of how you might create such a view:...
37,954
[ { "from": "human", "value": "In our database, we have a system set up to keep track of applications. We have a bool column that indicates whether or not the application is approved. Then there's another column that indicates whether or not the application is denied. If neither column is true, then the ap...
I have an archiving process that basically deletes archived records after a set number of days. Is it better to write a scheduled SQL job or a windows service to accomplish the deletion? The database is mssql2005. Update: To speak to some of the answers below, this question is regarding an in house application and ...
When deciding between a scheduled SQL job and a Windows service for deleting archived records after a set number of days in an in-house application using MSSQL 2005, both approaches have their merits. Here are some considerations to help you make your choice: ### Scheduled SQL Job **Advantages:** 1. **Simplicity**: S...
34,438
[ { "from": "human", "value": "I have an archiving process that basically deletes archived records after a set number of days. Is it better to write a scheduled SQL job or a windows service to accomplish the deletion? The database is mssql2005. \nUpdate:\nTo speak to some of the answers below, this questio...
I need to run a simple request/response python module under an existing system with windows/apache/FastCGI. All the FastCGI wrappers for python I tried work for Linux only (they use socket.fromfd() and other such shticks). Is there a wrapper that runs under windows?
Yes, there are a few options for using FastCGI with Python under a Windows environment. One of the most popular FastCGI wrappers for Python that works on Windows is `wfastcgi`. Here’s how you can set it up: ### 1. Install Python and Required Packages Ensure that you have Python installed on your Windows machine. You ...
35,844
[ { "from": "human", "value": "I need to run a simple request/response python module under an\nexisting system with windows/apache/FastCGI.\nAll the FastCGI wrappers for python I tried work for Linux only\n(they use socket.fromfd() and other such shticks).\nIs there a wrapper that runs under windows?\n" }, ...
I'm trying to find SQL statements that timed out using the SQL 2005 profiler. Is there a way to set such a filter?
In SQL Server Profiler, you can set up a filter to capture events related to SQL statements that timed out. While SQL Server Profiler doesn’t have a specific event that directly indicates a query timeout, you can filter for certain events that are likely to be associated with timeouts. Here’s how you can do it: 1. **O...
34,347
[ { "from": "human", "value": "I'm trying to find SQL statements that timed out using the SQL 2005 profiler. Is there a way to set such a filter?\n" }, { "from": "gpt", "value": "In SQL Server Profiler, you can set up a filter to capture events related to SQL statements that timed out. While SQL S...
I'm running Windows XP SP3 and I do have the latest .NET libraries installed, as well as Visual Studio 2008. I'm also running (and would like to continue to run) Apache HTTP Server as well, if that matters. Perhaps someone can provide a list of software that I need and then I can look up configuration or ask here if I ...
Running Windows XP SP3 with Visual Studio 2008 and the Apache HTTP Server, while ensuring compatibility with the .NET framework and any other tools you may need, can be achieved with a thoughtful selection of software. Below is a list of essential software you might consider, along with their purposes. ### Developmen...
35,384
[ { "from": "human", "value": "I'm running Windows XP SP3 and I do have the latest .NET libraries installed, as well as Visual Studio 2008. I'm also running (and would like to continue to run) Apache HTTP Server as well, if that matters.\nPerhaps someone can provide a list of software that I need and then I c...
I'm trying to learn Actionscript 2 or 3, with AS2 I eventually figured by trial and error that I could get any named instance and modify it using a string with its name using var theinstance = "titletext"; // actually exctracted from an array _root[theinstance].htmlText = "New text with <b>HTML!</b>"; but when trying ...
In ActionScript 3, you can access display objects using the `getChildByName()` method, but it's essential to note that the method should be called on a specific DisplayObjectContainer (like the stage or any MovieClip that has children), not directly on the `DisplayObject`. Here's how you can achieve this: 1. Make sur...
37,036
[ { "from": "human", "value": "I'm trying to learn Actionscript 2 or 3, with AS2 I eventually figured by trial and error that I could get any named instance and modify it using a string with its name using\nvar theinstance = \"titletext\"; // actually exctracted from an array\n_root[theinstance].htmlText = \"...
Is there a way to write an enumeration that can be extended. I have several methods that I would like to always have available for my enumerations. For example I use an enumeration for my database fields. I include the actual field name in the database. public enum ORDERFIELDS { OrderID("Order_I...
In Java, enums cannot be extended because they implicitly extend the `java.lang.Enum` class, and Java does not allow multiple inheritance. However, you can achieve a similar effect by defining an interface that contains the methods you want to be available for all your enums, and then have your enums implement this int...
30,857
[ { "from": "human", "value": "Is there a way to write an enumeration that can be extended. I have several methods that I would like to always have available for my enumerations. For example I use an enumeration for my database fields. I include the actual field name in the database. \npublic enum ORDERFIE...
I know that in JavaScript, creating a for loop like this: for(int i = 0; i < arr.length; i++) is costly as it computes the array length each time. Is this behavior costly in c# for lists and arrays as well. Or at compile-time is it optimized? Also what about other languages such as Java, how is this handled?
In JavaScript, the expression `arr.length` is computed each time the loop runs, which can lead to performance inefficiencies, particularly in large arrays. To mitigate this, it's common practice to store the length in a variable, like this: ```javascript for (let i = 0, len = arr.length; i < len; i++) { // Your co...
36,174
[ { "from": "human", "value": "I know that in JavaScript, creating a for loop like this: for(int i = 0; i < arr.length; i++) is costly as it computes the array length each time.\nIs this behavior costly in c# for lists and arrays as well. Or at compile-time is it optimized? Also what about other languages su...
Does the "for…in" loop in Javascript loop through the hashtables/elements in the order they are declared? Is there a browser which doesn't do it in order? The object I wish to use will be declared once and will never be modified. Suppose I have: var myObject = { A: "Hello", B: "World" }; And I further use them in: for...
In JavaScript, the `for...in` loop iterates over the enumerable properties of an object. The order of iteration is not explicitly defined in the ECMAScript specification, but there are some general rules based on how JavaScript engines implement property enumeration. As of ECMAScript 2015 (ES6) and later, the rules fo...
34,195
[ { "from": "human", "value": "Does the \"for…in\" loop in Javascript loop through the hashtables/elements in the order they are declared? Is there a browser which doesn't do it in order?\nThe object I wish to use will be declared once and will never be modified.\nSuppose I have:\nvar myObject = { A: \"Hello\...
I come from a mainly PHP background and make good use of the Apache error logs by using the command line. I've recently been handed a large ASP/ASP.NET project that I need to make changes to, where do I find the error logs on a Windows IIS setup so that I may troubleshoot some issues?
When working with an ASP.NET application on a Windows IIS server, you can find the error logs in a few different places. Here’s a guide on where to look: ### 1. **IIS Logs** IIS maintains its own log files that can be very helpful for troubleshooting. The default location for these log files is: ``` C:\inetpub\logs\L...
35,562
[ { "from": "human", "value": "I come from a mainly PHP background and make good use of the Apache error logs by using the command line. I've recently been handed a large ASP/ASP.NET project that I need to make changes to, where do I find the error logs on a Windows IIS setup so that I may troubleshoot some i...
What is a good use case for uncaught_exception?
`uncaught_exception` is a feature in C++ that allows you to check whether an exception has been thrown and not caught in a particular context. This is particularly useful when writing robust code that needs to maintain certain invariants or to clean up resources even when exceptions occur. A good use case for `uncaugh...
35,632
[ { "from": "human", "value": "What is a good use case for uncaught_exception?\n" }, { "from": "gpt", "value": "`uncaught_exception` is a feature in C++ that allows you to check whether an exception has been thrown and not caught in a particular context. This is particularly useful when writing ro...
What solutions do you have in place for handling bandwidth billing for your vhosts on a shared environment in apache? If you are using log parsing, does your solution scale well when the logs become very very large? Anyone using any sort of module out there for this?
Handling bandwidth billing for virtual hosts (vhosts) on a shared environment in Apache can be quite a challenge, especially when it comes to scaling and log management. Below are some solutions and methods that can help you manage this effectively: ### Solutions for Bandwidth Billing 1. **Log Parsing Tools**: - *...
35,939
[ { "from": "human", "value": "What solutions do you have in place for handling bandwidth billing for your vhosts on a shared environment in apache? If you are using log parsing, does your solution scale well when the logs become very very large? Anyone using any sort of module out there for this?\n" }, ...
What is the difference between atan and atan2 in C++?
In C++, `atan` and `atan2` are both functions used to compute the arctangent of a value, but they serve slightly different purposes and are used in different contexts. ### `atan` - **Function Prototype**: ```cpp double atan(double x); ``` - **Description**: The `atan` function computes the arctangent of a sin...
34,807
[ { "from": "human", "value": "What is the difference between atan and atan2 in C++?\n" }, { "from": "gpt", "value": "In C++, `atan` and `atan2` are both functions used to compute the arctangent of a value, but they serve slightly different purposes and are used in different contexts.\n\n### `atan...
I just realised that Office 2007 now shows multiple pages per default. I can finally take advantage of that huge monitor I've bought. Is there a similar feature with Visual Studio? Something like "View -> Two Pages"
Visual Studio does not have a direct "View -> Two Pages" feature similar to Microsoft Office that allows you to view multiple pages of code side by side in a single window. However, there are a few ways to manage your workspace effectively and take advantage of your large monitor: 1. **Split View**: You can split the ...
38,611
[ { "from": "human", "value": "I just realised that Office 2007 now shows multiple pages per default. I can finally take advantage of that huge monitor I've bought. \nIs there a similar feature with Visual Studio?\nSomething like \"View -> Two Pages\"\n" }, { "from": "gpt", "value": "Visual Studio...
What is best way to allow user to pick date from a mobile device from usability prospective?
When designing a date picker for mobile devices, usability is key to ensure that users can select dates easily and efficiently. Here are several best practices to consider: 1. **Use a Native Date Picker**: Whenever possible, leverage the mobile device's native date picker, as it’s already optimized for the platform an...
36,439
[ { "from": "human", "value": "What is best way to allow user to pick date from a mobile device from usability prospective?\n" }, { "from": "gpt", "value": "When designing a date picker for mobile devices, usability is key to ensure that users can select dates easily and efficiently. Here are seve...
Can anyone please tell me the issues that we face when using JCanvas3D instead of Canvas3D? How to achieve transparency using JCanvas3D? Regards, hariprasad
JCanvas3D and Canvas3D are tools used for rendering 3D graphics, but they come with their own sets of features, benefits, and potential issues. Here are some key differences and issues you might face when using JCanvas3D instead of Canvas3D: ### Issues with JCanvas3D Compared to Canvas3D: 1. **Performance**: JCanvas3...
34,775
[ { "from": "human", "value": "Can anyone please tell me the issues that we face when using JCanvas3D instead of Canvas3D?\nHow to achieve transparency using JCanvas3D?\nRegards,\nhariprasad\n" }, { "from": "gpt", "value": "JCanvas3D and Canvas3D are tools used for rendering 3D graphics, but they ...
In algebra if I make the statement x + y = 3, the variables I used will hold the values either 2 and 1 or 1 and 2. I know that assignment in programming is not the same thing, but I got to wondering. If I wanted to represent the value of, say, a quantumly weird particle, I would want my variable to have two values at t...
What you're describing touches on concepts from both quantum mechanics and programming, and while they operate in fundamentally different realms, there are some interesting parallels. In programming, variables typically hold a single value at a time, so you can't directly say something like `i = 3 or 2;` and have `i` ...
35,752
[ { "from": "human", "value": "In algebra if I make the statement x + y = 3, the variables I used will hold the values either 2 and 1 or 1 and 2. I know that assignment in programming is not the same thing, but I got to wondering. If I wanted to represent the value of, say, a quantumly weird particle, I would...
Anyone that used the (not anymore) freely available TPngImage by by Gustavo Daud tried porting their projects to Delphi 2009? In my case, it seems that all TImage png images that displayed just fine in D2007 are now blank when opening the form in D2009 (if I re-add the image in D2009, save the form and open it in D2007...
It sounds like you're encountering a compatibility issue with the way Delphi 2009 handles PNG images compared to Delphi 2007. Here are a few steps and suggestions that may help you resolve this issue: 1. **Check for Updates**: First, ensure that you are using the latest version of the TPngImage library. There may have...
36,390
[ { "from": "human", "value": "Anyone that used the (not anymore) freely available TPngImage by by Gustavo Daud tried porting their projects to Delphi 2009?\nIn my case, it seems that all TImage png images that displayed just fine in D2007 are now blank when opening the form in D2009 (if I re-add the image in...
Any good reason why $("p").html(0) makes all paragraphs empty as opposed to contain the character '0'? Instead of assuming I found a bug in jQuery, it's probably a misunderstanding on my part.
The behavior you're observing is related to how jQuery handles the `html()` method. When you call `$("p").html(0)`, you're actually invoking the jQuery `html()` method with a numeric value (0) as an argument. Here’s how `html()` works in jQuery: 1. **Setting HTML Content**: When you pass a string or a jQuery object t...
37,449
[ { "from": "human", "value": "Any good reason why $(\"p\").html(0) makes all paragraphs empty as opposed to contain the character '0'?\nInstead of assuming I found a bug in jQuery, it's probably a misunderstanding on my part.\n" }, { "from": "gpt", "value": "The behavior you're observing is relat...
If you have a java.io.InputStream object, how should you process that object and produce a String? Suppose I have an InputStream that contains text data, and I want to convert it to a String, so for example I can write that to a log file. What is the easiest way to take the InputStream and convert it to a String? publ...
To convert a `java.io.InputStream` to a `String`, you can read the data from the stream and accumulate it into a `StringBuilder`. Below is a complete implementation of the `convertStreamToString` method using a `BufferedReader` for efficient reading: ```java import java.io.BufferedReader; import java.io.IOException; i...
36,027
[ { "from": "human", "value": "If you have a java.io.InputStream object, how should you process that object and produce a String?\n\nSuppose I have an InputStream that contains text data, and I want to convert it to a String, so for example I can write that to a log file.\nWhat is the easiest way to take the ...
Is there a way to disable SSL on WAS? So you can just log on using a username and password. That isnt tied to disabling the Global Security? Cheers
Disabling SSL on IBM WebSphere Application Server (WAS) while retaining some level of security through username and password authentication can be a bit tricky, as SSL is typically used to secure communications between clients and servers. However, if your goal is to allow non-SSL connections while still utilizing the ...
36,183
[ { "from": "human", "value": "Is there a way to disable SSL on WAS? So you can just log on using a username and password. That isnt tied to disabling the Global Security?\nCheers\n" }, { "from": "gpt", "value": "Disabling SSL on IBM WebSphere Application Server (WAS) while retaining some level of...
Unfortunately I don't have access to a *nix box at work or at home. The only way I can play with Haskell is on windows. Anyone here using Haskell on Windows? What's your setup?
Yes, you can definitely use Haskell on Windows! Here are some options for setting up a Haskell environment on a Windows machine: 1. **GHCup**: This is a tool that helps you install GHC (the Glasgow Haskell Compiler), Cabal (a system for building and packaging Haskell libraries and programs), and Stack (a cross-platfor...
35,792
[ { "from": "human", "value": "Unfortunately I don't have access to a *nix box at work or at home. The only way I can play with Haskell is on windows. Anyone here using Haskell on Windows? What's your setup?\n" }, { "from": "gpt", "value": "Yes, you can definitely use Haskell on Windows! Here ar...
Given an SQLConnection object how can you get a schema for a single table? I seemed to be able to get the schema from a DataSet which I'd gotten from running a query, but all the schema info I could get from the connection seemed to be related to what tables were available and not the actual details on the tables.
To get the schema of a single table using an `SqlConnection` object in ADO.NET, you can utilize the `SqlCommand` and `SqlDataReader` classes to execute a command that retrieves the schema information for the specific table. Here's a step-by-step approach to achieving this: ### Step 1: Create an SqlConnection First, en...
15,243
[ { "from": "human", "value": "Given an SQLConnection object how can you get a schema for a single table?\nI seemed to be able to get the schema from a DataSet which I'd gotten from running a query, but all the schema info I could get from the connection seemed to be related to what tables were available and ...
I don't want to use the default route that vs.net creates: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); I on...
To configure your ASP.NET MVC application so that only the root URL (`www.example.com/`) maps to the `HomeController`'s `Index` action, you can modify your route configuration in the `RouteConfig.cs` file. You can achieve this by specifying a route for the root URL before the default route. Here’s how you can set it ...
36,055
[ { "from": "human", "value": "I don't want to use the default route that vs.net creates:\nroutes.MapRoute(\n \"Default\", // Route name\n \"{controller}/{action}/{id}\", // URL with parameters\n new { controller = \"Home\", action ...
I can use "FlashWindowEx" to make a window flash in the taskbar, but what can I call to determine if that has been done to a window? Is there a flag that gets set somewhere that I can query?
In the Windows API, there is no direct flag or property that you can query to determine if a window is currently set to flash in the taskbar using `FlashWindowEx`. However, there are some indirect methods you might consider: 1. **Custom State Management**: Maintain your own state in your application. When you call `Fl...
35,917
[ { "from": "human", "value": "I can use \"FlashWindowEx\" to make a window flash in the taskbar, but what can I call to determine if that has been done to a window? Is there a flag that gets set somewhere that I can query?\n" }, { "from": "gpt", "value": "In the Windows API, there is no direct fl...
Using the Facebook API, is there a way of getting a friend's phone/cell number? I'm sure I saw an app a while ago that could sync Facebook with your Mac Address Book, but I haven't found anything in the API documentation that allows you to get a friend's number. Is this possible? Thanks in advance.
As of my last update in October 2023, Facebook's API does not allow access to friends' phone numbers or any personal contact information due to privacy concerns and data protection regulations. Facebook has strict policies regarding user data and privacy, and personal information like phone numbers is considered sensit...
38,210
[ { "from": "human", "value": "Using the Facebook API, is there a way of getting a friend's phone/cell number? I'm sure I saw an app a while ago that could sync Facebook with your Mac Address Book, but I haven't found anything in the API documentation that allows you to get a friend's number. Is this possible...
I have a function which searches an STL container then returns the iterator when it finds the position, however I am getting some funny error messages, can tell me what I am doing wrong? Function: std::vector< CClass >::iterator CClass::SearchFunction( const std::string& strField ) { ... return it; ... } Error: e...
The error message you're seeing indicates that there is a type mismatch between the iterator types being used in your `SearchFunction`. This is likely occurring because you are trying to return an iterator from a `std::vector<CClass>` while using a `std::vector<CClass>::const_iterator`. Let's break it down: 1. **Iter...
36,617
[ { "from": "human", "value": "I have a function which searches an STL container then returns the iterator when it finds the position, however I am getting some funny error messages, can tell me what I am doing wrong?\nFunction:\nstd::vector< CClass >::iterator CClass::SearchFunction( const std::string& strFi...
I need to make some changes to a ClickOnce application that I haven't touched for over a year and therefore the certificate has expired. I've read that publishing with a new certificate will make the application fail, because it will be signed with a different key. Therefore I think I need to use the same certificate b...
To renew an expired certificate for your ClickOnce application, you generally have two options: ### 1. Use the Same Certificate (If You Have Access) If you still have access to the original certificate (the PFX file), you can simply renew it. Here’s how to do it: 1. **Locate the Original Certificate**: If you still h...
33,024
[ { "from": "human", "value": "I need to make some changes to a ClickOnce application that I haven't touched for over a year and therefore the certificate has expired.\nI've read that publishing with a new certificate will make the application fail, because it will be signed with a different key.\nTherefore I...
I would like to add a backcolor for specific line depending of a Property of the object binded. The solution I have (and it works) is to use the Event DataBindingComplete but I do not think it's the best solution. Here is the event: private void myGrid_DataBindingComplete(object sender, DataGridViewBindingCompleteE...
Using the `DataBindingComplete` event is a common and straightforward approach to change row colors based on the data, but it can be inefficient, especially if the grid has many rows or if the data is frequently changing. A more efficient way to handle row coloring based on object properties is to use the `CellFormatti...
35,428
[ { "from": "human", "value": "I would like to add a backcolor for specific line depending of a Property of the object binded.\nThe solution I have (and it works) is to use the Event DataBindingComplete but I do not think it's the best solution.\nHere is the event:\n private void myGrid_DataBindingComplete...
Is it possible in Actionscript 3 to create a weak reference to an object, so that it can be garbage collected. I'm creating some classes to make debugging easier, so I don't want the objects to hang around in memory if they are only referenced here (and of course I don't want to fill the code with callbacks to remove t...
In ActionScript 3 (AS3), there is no built-in mechanism to create weak references to objects like you might find in some other programming languages (such as Java with its `WeakReference` class). In AS3, when you create a reference to an object, it is a strong reference, meaning that as long as that reference exists, t...
32,517
[ { "from": "human", "value": "Is it possible in Actionscript 3 to create a weak reference to an object, so that it can be garbage collected.\nI'm creating some classes to make debugging easier, so I don't want the objects to hang around in memory if they are only referenced here (and of course I don't want t...
I am following a VB tutorial to do some HTML manipulation using LINQ It has the following construct Imports <xmlns="http://www.w3.org/1999/xhtml"> How do I do the same in C#? There appears to be something called an XMLNamespaceManager that may hold the solution, but I am too foolish to understand how to work it, and ...
In C#, you can use the `XNamespace` class from the `System.Xml.Linq` namespace to work with XML namespaces, similar to what you are doing in VB.NET with `Imports`. If you are manipulating HTML content with LINQ to XML, you'll want to declare the namespace at the beginning of your code and use it when querying the eleme...
37,171
[ { "from": "human", "value": "I am following a VB tutorial to do some HTML manipulation using LINQ \nIt has the following construct\nImports <xmlns=\"http://www.w3.org/1999/xhtml\">\n\nHow do I do the same in C#?\nThere appears to be something called an XMLNamespaceManager that may hold the solution, but I a...
I suppose there could be historical reasons for this naming and that other languages have similar feature, but it also seems to me that parameters always had a name in C#. Arguments are the unnamed ones. Or is there a particular reason why this terminology was chosen?
You're correct in your understanding of the terminology used in C# and many other programming languages, and this distinction does have historical and technical foundations. ### Terminology 1. **Parameters**: These are the variables listed as part of a method or function definition. When you define a method, you spec...
36,734
[ { "from": "human", "value": "I suppose there could be historical reasons for this naming and that other languages have similar feature, but it also seems to me that parameters always had a name in C#. Arguments are the unnamed ones. Or is there a particular reason why this terminology was chosen?\n" }, ...
How to rewrite this: select tab1.id, tab2.id, tab3.id from tab1, tab2, tab3 where tab1.col1 = tab2.col1(+) and tab2.col2 = tab3.col2(+); using OUTER JOIN syntax?
You can rewrite the SQL query using OUTER JOIN syntax as follows: ```sql SELECT tab1.id, tab2.id, tab3.id FROM tab1 LEFT OUTER JOIN tab2 ON tab1.col1 = tab2.col1 LEFT OUTER JOIN tab3 ON tab2.col2 = tab3.col2; ``` In this query: - The `LEFT OUTER JOIN` with `tab2` means that all records from `tab1` will be included in...
38,625
[ { "from": "human", "value": "How to rewrite this:\nselect tab1.id, tab2.id, tab3.id \nfrom tab1, tab2, tab3 \nwhere tab1.col1 = tab2.col1(+) and tab2.col2 = tab3.col2(+);\n\nusing OUTER JOIN syntax?\n" }, { "from": "gpt", "value": "You can rewrite the SQL query using OUTER JOIN syntax as follows...
I have build a website. in that website there is section to download file using php script. our company has two ISP connections. one ISP allows to dowload file but other blocks it. i thought this is browser problem but after hit and try methods, i come to conclusion that this is ISP problem. Am i right. please help me ...
Based on your description, it seems like you've accurately diagnosed the situation. Here are some points to consider: 1. **ISP Restrictions**: ISPs can impose restrictions on certain types of traffic or file downloads. If one ISP allows the file download while the other blocks it, it's likely that the blocked ISP has ...
36,436
[ { "from": "human", "value": "I have build a website. in that website there is section to download file using php script.\nour company has two ISP connections. one ISP allows to dowload file but other blocks it.\ni thought this is browser problem but after hit and try methods, i come to conclusion that this ...
I cant' figure out how to reference the current instance object defined by the XAML file in the XAML file. I have a converter that I want to send in the current instance as the parameter object. {Binding Path=<bindingObject>, Converter={x:Static namespace:Converter.Instance}, ConverterParameter=this} In this code this...
In XAML, you can't directly use the `this` keyword to reference the current instance of the object. However, you can use a workaround to achieve what you want by binding to the `RelativeSource`. Here's a typical approach: 1. Use the `RelativeSource` to refer to the current data context or element in the binding. 2. If...
33,399
[ { "from": "human", "value": "I cant' figure out how to reference the current instance object defined by the XAML file in the XAML file.\nI have a converter that I want to send in the current instance as the parameter object.\n{Binding Path=<bindingObject>, Converter={x:Static namespace:Converter.Instance}, ...
I am new to RESTful stuff. But, I want to use it in my rails app. When I add this to my routes.rb map.resources :notes I get routes to these methods created: index create new edit show update destroy What I am wondering is what is the difference between edit/update and create/new? Is there any standard definitions...
Welcome to the world of RESTful applications in Rails! Understanding the differences between the methods you're asking about is crucial for building a well-structured application. ### RESTful Actions In RESTful architecture, each of the methods you mentioned corresponds to a specific action regarding resource managem...
34,805
[ { "from": "human", "value": "I am new to RESTful stuff. But, I want to use it in my rails app. When I add this to my routes.rb map.resources :notes I get routes to these methods created:\n\nindex\ncreate\nnew\nedit\nshow\nupdate\ndestroy\n\nWhat I am wondering is what is the difference between edit/update...
Is there any software to help in learning / understanding / experimenting with the rules of harmony and counterpoint?
Yes, there are several software programs and applications designed to help with learning and experimenting with harmony and counterpoint. Here are some options: 1. **MuseScore**: This is a free notation software that allows you to write music and play it back. It also has plugins for various educational purposes, incl...
35,511
[ { "from": "human", "value": "Is there any software to help in learning / understanding / experimenting with the rules of harmony and counterpoint?\n" }, { "from": "gpt", "value": "Yes, there are several software programs and applications designed to help with learning and experimenting with harm...
I have updated to latest Django version 1.0.2 after uninstalling my old Django version.But now when I run django-admin.py I get the following error. How can I resolve this? Traceback (most recent call last): File "C:\Python25\Lib\site-packages\django\bin\django-admin.py", line 2, in <module> from django.core impo...
The error message you're seeing indicates that the `django.core` module is not found, which usually means that Django is not properly installed or not available in your Python environment. Here are a few steps you can take to resolve this issue: 1. **Verify Installation**: Make sure Django is installed correctly. Y...
35,547
[ { "from": "human", "value": "I have updated to latest Django version 1.0.2 after uninstalling my old Django version.But now when I run django-admin.py I get the following error. How can I resolve this?\nTraceback (most recent call last):\n File \"C:\\Python25\\Lib\\site-packages\\django\\bin\\django-admin....
How can I rename a Virtual Directory (or Web Application) in IIS 6.0/7.0 using VBScript?
Renaming a Virtual Directory or Web Application in IIS 6.0 or 7.0 using VBScript requires interaction with the IIS metabase or WMI (Windows Management Instrumentation) respectively. Below are examples of how to accomplish this task for both IIS 6.0 and IIS 7.0. ### Renaming a Virtual Directory in IIS 6.0 In IIS 6.0, ...
32,722
[ { "from": "human", "value": "How can I rename a Virtual Directory (or Web Application) in IIS 6.0/7.0 using VBScript?\n" }, { "from": "gpt", "value": "Renaming a Virtual Directory or Web Application in IIS 6.0 or 7.0 using VBScript requires interaction with the IIS metabase or WMI (Windows Manag...
I've written a batch execution framework and in it I want (in some scenarios) to load an assembly from the GAC where there may be multiple versions but I just want to load the latest version. Is this even possible? TIA
Yes, it is possible to load the latest version of an assembly from the Global Assembly Cache (GAC) in .NET, but there are some nuances to consider. Here’s a general approach and considerations for achieving this. ### General Approach: 1. **List Assemblies in the GAC:** You can use the `System.Reflection` namespace an...
34,812
[ { "from": "human", "value": "I've written a batch execution framework and in it I want (in some scenarios) to load an assembly from the GAC where there may be multiple versions but I just want to load the latest version.\nIs this even possible?\nTIA\n" }, { "from": "gpt", "value": "Yes, it is po...
In Joomla 1.0, the current User object was stored in a global variable called $my. This doesn't exist in Joomla 1.5 any more - how do I get that object? Also, how can you tell if the user hasn't logged in?
In Joomla 1.5 and later versions, the way to access the current user has changed from using the global variable `$my` to using the `JFactory` class. To get the current user object, you can use the following code: ```php $user = JFactory::getUser(); ``` This code retrieves the current user object, and you can access i...
38,269
[ { "from": "human", "value": "In Joomla 1.0, the current User object was stored in a global variable called $my. This doesn't exist in Joomla 1.5 any more - how do I get that object? Also, how can you tell if the user hasn't logged in?\n" }, { "from": "gpt", "value": "In Joomla 1.5 and later vers...
I want to do sparse high dimensional (a few thousand features) least squares regression with a few hundred thousands of examples. I'm happy to use non fancy optimisation - stochastic gradient descent is fine. Does anyone know of any software already implemented for doing this, so I don't have to write to my own? Kind r...
Yes, there are several software libraries and frameworks that can help you perform sparse high-dimensional least squares regression using stochastic gradient descent (SGD). Here are some popular options: 1. **Scikit-learn**: This Python library has built-in support for various regression models, including Lasso (which...
29,696
[ { "from": "human", "value": "I want to do sparse high dimensional (a few thousand features) least squares regression with a few hundred thousands of examples. I'm happy to use non fancy optimisation - stochastic gradient descent is fine.\nDoes anyone know of any software already implemented for doing this, ...
I'm curious to know whether the PDFKit framework is available for use within the iPhone OS, in order to build a PDF reader a bit more sophisticated than the one available by simply opening PDF documents with UIWebView. Just wondering if this is an option or not.
Yes, PDFKit is available for use within iOS. It was introduced in iOS 11, and it provides a robust framework for working with PDF documents. With PDFKit, you can create more sophisticated PDF readers and editors than what can be achieved with a simple UIWebView. PDFKit includes features for rendering PDF documents, na...
38,996
[ { "from": "human", "value": "I'm curious to know whether the PDFKit framework is available for use within the iPhone OS, in order to build a PDF reader a bit more sophisticated than the one available by simply opening PDF documents with UIWebView.\nJust wondering if this is an option or not.\n" }, { ...
I'm constructing a method to take in an ArrayList(presumably full of objects) and then list all the fields(and their values) for each object in the ArrayList. Currently my code is as follows: public static void ListArrayListMembers(ArrayList list) { foreach (Object obj in list) { Type ty...
You're on the right track, but you'll need to iterate through the fields of each object and retrieve their names and values individually. The `GetFields()` method returns an array of `FieldInfo` objects, which you can loop through to get the field names and values. Here's a revised version of your `ListArrayListMembe...
35,506
[ { "from": "human", "value": "I'm constructing a method to take in an ArrayList(presumably full of objects) and then list all the fields(and their values) for each object in the ArrayList.\nCurrently my code is as follows:\npublic static void ListArrayListMembers(ArrayList list)\n {\n foreach (Obje...
I need to have a string, based on an integer, which should always have 5 digits. Example: myInteger = 999 formatedInteger = "00999" What is the best way of doing this in classic ASP?
In Classic ASP, you can format an integer to always have 5 digits by using the `Right` function combined with string concatenation. Specifically, you can convert the integer to a string, pad it with leading zeros, and then extract the rightmost 5 characters. Here’s how you can do it: ```asp <% Function FormatIntegerTo...
38,026
[ { "from": "human", "value": "I need to have a string, based on an integer, which should always have 5 digits.\nExample:\nmyInteger = 999\nformatedInteger = \"00999\"\n\nWhat is the best way of doing this in classic ASP?\n" }, { "from": "gpt", "value": "In Classic ASP, you can format an integer t...
I Have "SQL Native Client", but not "SQL Server" ODBC driver. I have SQL 2005 installed on my machine. Tried to fix by installing SQL Server client tools. Any ideas would be appreciated. I'm running Windows XP Pro.
If you're running SQL Server 2005 and you want to ensure that you have the proper ODBC drivers, here are a few steps you can take: 1. **Confirm Installation of SQL Server Components**: Make sure that SQL Server 2005 and all necessary components are properly installed on your machine. This includes the SQL Server Na...
31,150
[ { "from": "human", "value": "I Have \"SQL Native Client\", but not \"SQL Server\" ODBC driver. I have SQL 2005 installed on my machine.\nTried to fix by installing SQL Server client tools.\nAny ideas would be appreciated.\nI'm running Windows XP Pro.\n" }, { "from": "gpt", "value": "If you're ru...
Is there any way to display scrollabletext in loose xaml? The equivalent in HTML would be <div style="overflow:scroll">some long bit of text here</div> Can you do this in loose xaml? From my experiments so far it seems that in loose xaml: You cannot use TextBox -- it must be TextBlock. TextBlock doesn't seem to ...
In WPF, when working with loose XAML, you indeed have some limitations, particularly with regards to certain controls and layouts. However, you can still achieve a scrollable text display using a combination of `ScrollViewer` and `TextBlock` in loose XAML. Although you mentioned that `ScrollViewer` doesn't seem to be ...
37,835
[ { "from": "human", "value": "Is there any way to display scrollabletext in loose xaml? The equivalent in HTML would be \n<div style=\"overflow:scroll\">some long bit of text here</div>\n\nCan you do this in loose xaml? \nFrom my experiments so far it seems that in loose xaml:\n\nYou cannot use TextBox -- ...
I used the owner-drawn strategy on CMyListBox class which derives from CListBox. I only want the DrawItem() method to perform when I insert an item in the listbox. But the method is invoked many times. How can I change to invoke it whenever I need.
In a typical owner-drawn control in MFC (Microsoft Foundation Classes), the `DrawItem` method is called automatically by the framework whenever the list box needs to be repainted. This includes scenarios such as when you add items, scroll, or resize the control. If you want to control when the `DrawItem` method is invo...
29,199
[ { "from": "human", "value": "I used the owner-drawn strategy on CMyListBox class which derives from CListBox. I only want the DrawItem() method to perform when I insert an item in the listbox. But the method is invoked many times. How can I change to invoke it whenever I need.\n" }, { "from": "gpt",...
Is there a quick-and-dirty way to tell programmatically, in shell script or in Perl, whether a path is located on a remote filesystem (nfs or the like) or a local one? Or is the only way to do this to parse /etc/fstab and check the filesystem type?
There are a few methods you can use to programmatically determine whether a path is located on a remote filesystem, such as NFS, or a local one, without needing to parse `/etc/fstab`. Here are a couple of options in both shell script and Perl: ### Shell Script Method You can use the `df` command along with `grep` to ...
33,625
[ { "from": "human", "value": "Is there a quick-and-dirty way to tell programmatically, in shell script or in Perl, whether a path is located on a remote filesystem (nfs or the like) or a local one? Or is the only way to do this to parse /etc/fstab and check the filesystem type?\n" }, { "from": "gpt",...
something.each do |x| #lots of stuff end if some_condition
In Ruby, the provided code snippet iterates over a collection `something` and performs operations on each element `x`. However, the iteration is conditionally executed based on `some_condition`. The use of the `if` statement at the end of the block allows for a cleaner and more readable syntax in certain cases. Here i...
34,240
[ { "from": "human", "value": "something.each do |x|\n\n #lots of stuff\n\nend if some_condition\n\n" }, { "from": "gpt", "value": "In Ruby, the provided code snippet iterates over a collection `something` and performs operations on each element `x`. However, the iteration is conditionally execut...
Which command will executed first,If a stored procedure have individual multiple select commands;
In a stored procedure that contains multiple `SELECT` commands, the order of execution is determined by the sequence in which the commands are written within the stored procedure. SQL executes statements in the order they appear, unless there are control flow statements (like `IF`, `WHILE`, or `CASE`) that alter the ex...
38,774
[ { "from": "human", "value": "Which command will executed first,If a stored procedure have individual multiple select commands;\n" }, { "from": "gpt", "value": "In a stored procedure that contains multiple `SELECT` commands, the order of execution is determined by the sequence in which the comman...
I want to select the last 5 records from a table in SQL Server without arranging the table in ascending or descending order.
In SQL Server, if you want to select the last 5 records from a table without explicitly ordering the results in ascending or descending order, you would typically utilize the `OFFSET` and `FETCH` clauses along with the `ORDER BY` clause. However, since your requirement is to avoid any ordering, it’s important to note t...
37,581
[ { "from": "human", "value": "I want to select the last 5 records from a table in SQL Server without arranging the table in ascending or descending order.\n" }, { "from": "gpt", "value": "In SQL Server, if you want to select the last 5 records from a table without explicitly ordering the results ...
I've been tasked with integration testing of a large system. Presently, I have a COM dll that I'm testing useing a UI that I created that kicks off a series of unit tests that call into the dll. This works, but I'm wanting to migrate this over to MbUnit. When I start the first test in MbUnit, it seems to hang at "Foun...
When you're experiencing a hang in MbUnit while trying to run tests, it can be frustrating. Here are some steps you can take to troubleshoot and resolve the issue: 1. **Check for Deadlocks**: If your COM DLL interacts with multiple threads or has any blocking calls, there might be a deadlock. Review your code for pote...
36,955
[ { "from": "human", "value": "I've been tasked with integration testing of a large system. Presently, I have a COM dll that I'm testing useing a UI that I created that kicks off a series of unit tests that call into the dll. This works, but I'm wanting to migrate this over to MbUnit. When I start the first ...
How do you rename a file to include the datetime using the windows command line?
You can rename a file to include the current date and time using the Windows Command Line (CMD). Here's a step-by-step guide: 1. **Open Command Prompt**: You can do this by typing `cmd` in the Start menu search bar and pressing Enter. 2. **Navigate to the directory**: Use the `cd` command to navigate to the directory...
32,901
[ { "from": "human", "value": "How do you rename a file to include the datetime using the windows command line?\n" }, { "from": "gpt", "value": "You can rename a file to include the current date and time using the Windows Command Line (CMD). Here's a step-by-step guide:\n\n1. **Open Command Prompt...
I have a MySQL table where an indexed INT column is going to be 0 for 90% of the rows. If I change those rows to use NULL instead of 0, will they be left out of the index, making the index about 90% smaller?
Yes, changing the indexed INT column from 0 to NULL will have an impact on the indexing. In MySQL, when you have a standard index on a column that contains many rows with the same value (in your case, 0), the index can become less efficient, especially if the majority of the rows share that value. By using NULL instea...
37,745
[ { "from": "human", "value": "I have a MySQL table where an indexed INT column is going to be 0 for 90% of the rows. If I change those rows to use NULL instead of 0, will they be left out of the index, making the index about 90% smaller?\n" }, { "from": "gpt", "value": "Yes, changing the indexed ...
If for example you follow the link: data:application/octet-stream;base64,SGVsbG8= The browser will prompt you to download a file consisting of the data held as base64 in the hyperlink itself. Is there any way of suggesting a default name in the markup? If not, is there a JavaScript solution?
When you use a `data:` URL with the browser, it will typically prompt the user to download the file, but there isn't a way to specify a default filename directly in the `data:` URL itself. However, you can achieve this using JavaScript. ### JavaScript Solution You can create a Blob from your base64 data and use the `U...
35,148
[ { "from": "human", "value": "If for example you follow the link:\ndata:application/octet-stream;base64,SGVsbG8=\n\nThe browser will prompt you to download a file consisting of the data held as base64 in the hyperlink itself. Is there any way of suggesting a default name in the markup? If not, is there a J...
Is there any windows simulator availabe through which I can test (only testing) my iPhone application on Windows XP? Thanks & regards, Khushi
As of my last knowledge update in October 2023, there are no official iOS simulators available for Windows, including Windows XP, that would allow you to test iPhone applications directly. Apple's official simulator, Xcode, is only available on macOS. However, there are some third-party tools and services that you can...
37,624
[ { "from": "human", "value": "Is there any windows simulator availabe through which I can test (only testing) my iPhone application on Windows XP?\nThanks & regards,\nKhushi\n" }, { "from": "gpt", "value": "As of my last knowledge update in October 2023, there are no official iOS simulators avail...
Possible Duplicate: How do I mark a method as Obsolete/Deprecated? - C# How do you mark a class as deprecated? I do not want to use a class any more in my project, but do not want to delete it before a period of 2 weeks.
In C#, you can mark a class as deprecated (or obsolete) using the `[Obsolete]` attribute. This attribute can be applied to classes, methods, properties, and other members to indicate that they should not be used anymore. You can also provide a message that explains the reason for the deprecation and suggest an alternat...
37,034
[ { "from": "human", "value": "\nPossible Duplicate:\nHow do I mark a method as Obsolete/Deprecated? - C# \n\nHow do you mark a class as deprecated? I do not want to use a class any more in my project, but do not want to delete it before a period of 2 weeks.\n" }, { "from": "gpt", "value": "In C#,...
What is the best way to convert a fixed length string array to a fixed lengh integer array in C++ ?
To convert a fixed-length string array to a fixed-length integer array in C++, you can follow a straightforward approach. You would iterate through the string array, convert each string to an integer using `std::stoi` or `std::strtol`, and store the results in the integer array. Below is a step-by-step example: 1. **D...
35,165
[ { "from": "human", "value": "What is the best way to convert a fixed length string array to a fixed lengh integer array in C++ ?\n" }, { "from": "gpt", "value": "To convert a fixed-length string array to a fixed-length integer array in C++, you can follow a straightforward approach. You would it...
Is there a way to determine (.NET preferably) if the current user is a domain user account or local user account? Ahead of time - I don not know the domain name this is running on so I can't just look for DOMAIN\Username v COMPUTER\Username. Part of the answer could be determining the DOMAIN or COMPUTER name from code...
Yes, you can determine whether the current user is a domain user account or a local user account in a .NET application. The code you provided is a good starting point. Here's an expanded version of the method that checks if the current user is a local user or a domain user account: ```csharp using System; using Syst...
36,568
[ { "from": "human", "value": "Is there a way to determine (.NET preferably) if the current user is a domain user account or local user account?\nAhead of time - I don not know the domain name this is running on so I can't just look for DOMAIN\\Username v COMPUTER\\Username. \nPart of the answer could be dete...
The following Perl statements behave identically on Unixish machines. Do they behave differently on Windows? If yes, is it because of the magic \n? split m/\015\012/ms, $http_msg; split m/\015\012/s, $http_msg; I got a failure on one of my CPAN modules from a Win32 smoke tester. It looks like it's an \r\n vs \n...
Yes, the behavior of these two Perl statements can indeed differ between Unix-like systems and Windows, primarily due to how newlines are handled in text files on different operating systems. ### Breakdown of the Statements: 1. `split m/\015\012/ms, $http_msg;` 2. `split m/\015\012/s, $http_msg;` ### Explanation of M...
30,911
[ { "from": "human", "value": "The following Perl statements behave identically on Unixish machines. Do they behave differently on Windows? If yes, is it because of the magic \\n?\n split m/\\015\\012/ms, $http_msg;\n split m/\\015\\012/s, $http_msg;\n\nI got a failure on one of my CPAN modules from a Win...
I will show the problem with a example. There is some text in the textbox such here: Hi! this is a example [lnk]text[/lnk] When i push the submit button and publish this text, the word in the [lnk] and [/lnk] tags must be a link like this www.mysite.com?link=text. How do I make it easily with javascript or jquery? Not...
You can achieve this using JavaScript or jQuery by replacing the content inside the custom tags (`[lnk]` and `[/lnk]`) with an HTML anchor (`<a>`) tag. Below is an example that demonstrates how to do this. ### Example HTML ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="view...
34,090
[ { "from": "human", "value": "I will show the problem with a example.\nThere is some text in the textbox such here:\nHi! this is a example [lnk]text[/lnk]\nWhen i push the submit button and publish this text, the word in the [lnk] and [/lnk] tags must be a link like this www.mysite.com?link=text. \nHow do I ...
I've tried reading a JPG file using the StreamReader class' ReadToEnd() method which returns a string. For some reason though, when I write this string out to a file, it doesn't open. Is something lost when reading data into a string?
Yes, using the `StreamReader` class to read a JPG file (or any binary file) is not the right approach, and it will indeed result in data loss. The `StreamReader` is designed for reading text files, and it expects the file contents to be encoded as text. When you read a binary file such as a JPG, the binary data is inte...
33,811
[ { "from": "human", "value": "I've tried reading a JPG file using the StreamReader class' ReadToEnd() method which returns a string.\nFor some reason though, when I write this string out to a file, it doesn't open.\nIs something lost when reading data into a string?\n" }, { "from": "gpt", "value"...
I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this: sqlstring = string.Format("set nocount on;update myusers set geo=geography::Point({0}, {1}, 4326) where userid={2};", mlat, mlong, userid); _session.CreateSQLQuery(sqlstring).ExecuteUpdate(); However I receive the following error: 'geogra...
The error you're encountering, `'geography@p0' is not a recognized built-in function name`, suggests that the way you're using parameters in your SQL query is incorrect. In NHibernate, when you're using `CreateSQLQuery`, you cannot directly interpolate parameters into the SQL string. Instead, you should use parameter p...
37,531
[ { "from": "human", "value": "I am trying to issue a SQL update statement with nHibernate (2.0.1GA) like this:\nsqlstring = string.Format(\"set nocount on;update myusers set geo=geography::Point({0}, {1}, 4326) where userid={2};\", mlat, mlong, userid);\n_session.CreateSQLQuery(sqlstring).ExecuteUpdate();\n\...