instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I have just discovered the nifty unhandled exception handler for cocoa-touch. Now that I can gracefully notify the user about any unhandled exceptions that might crash my application, I'd like to shut down my application after notifying the user that a crash has occured. Does anyone know how to shut down an application...
In iOS applications, there isn't a direct API call to terminate the app programmatically because Apple discourages abrupt app terminations in favor of a smoother user experience. However, if you're handling an unhandled exception and want to gracefully shut down the app after notifying the user, you can achieve this by...
32,578
[ { "from": "human", "value": "I have just discovered the nifty unhandled exception handler for cocoa-touch.\nNow that I can gracefully notify the user about any unhandled exceptions that might crash my application, I'd like to shut down my application after notifying the user that a crash has occured.\nDoes ...
How can i generate bytecode (Byte[]) from a String at runtime, without using a "javac" process or something of this sort? is there a simple way of calling the compiler like that? later addition: I chose to accept the solution that actually best fits my situation. my application is a hobby-project still in design sketch...
If you're looking to execute code at runtime without compiling Java source files through an external process, you can use a JavaScript engine like Rhino or Nashorn (if you're using a Java version that includes it) to evaluate JavaScript code directly. This is a good approach if you're considering using JavaScript due t...
27,361
[ { "from": "human", "value": "How can i generate bytecode (Byte[]) from a String at runtime, without using a \"javac\" process or something of this sort? is there a simple way of calling the compiler like that?\nlater addition:\nI chose to accept the solution that actually best fits my situation. my applicat...
I hear that tr1::result_of gets used frequently inside of Boost... I'm wondering if there are any good (simple) use cases for tr1::result_of I can use at home.
`tr1::result_of` is a utility that can be used to deduce the result type of a callable object when applied to a set of argument types. Although it's part of the TR1 (Technical Report 1) library, the functionality has been incorporated into C++11 as `std::result_of`, and you can use the C++11 standard library instead. N...
29,575
[ { "from": "human", "value": "I hear that tr1::result_of gets used frequently inside of Boost... I'm wondering if there are any good (simple) use cases for tr1::result_of I can use at home.\n" }, { "from": "gpt", "value": "`tr1::result_of` is a utility that can be used to deduce the result type o...
I have a git repository with remote foo. foo is a web app, is contains some files and dirs directly in its root: Rakefile app ... public script My main git repository is a larger system which comprises this web app. I want to pull the commits from foo, but I need the files to reside inside the web dir. So they should ...
To achieve this, you can use Git's subtree feature. This will allow you to pull the contents of your `foo` repository and place them into a specific directory in your main repository (`web/` in your case). Here are the steps to follow: 1. **Add Remote**: If you haven't already, add `foo` as a remote in your main repos...
30,936
[ { "from": "human", "value": "I have a git repository with remote foo.\nfoo is a web app, is contains some files and dirs directly in its root:\nRakefile\napp\n...\npublic\nscript\n\nMy main git repository is a larger system which comprises this web app. I want to pull the commits from foo, but I need the fi...
I am using the Model-View-Presenter pattern for a web page. Should the presenter be aware of Session or should only the view be aware of it? I guess what I am getting at is that concepts like Session are very related to the architecture of the view so should they be limited to use by the view? Otherwise what would happ...
The Model-View-Presenter (MVP) pattern is designed to separate concerns in a way that makes your application easier to maintain, test, and extend. Regarding your question about whether the presenter should be aware of the session, there are a few considerations to keep in mind: ### Separation of Concerns 1. **Present...
31,070
[ { "from": "human", "value": "I am using the Model-View-Presenter pattern for a web page. Should the presenter be aware of Session or should only the view be aware of it?\nI guess what I am getting at is that concepts like Session are very related to the architecture of the view so should they be limited to ...
I have a method on the model Category called create_main used to create main categories. Should I use this method in the before(:each) section even though the method itself has to be tested, or should the main category be created manually using rails built in functionality.
When writing tests, especially in a Rails application, the general approach is to isolate the unit of work you want to test. If you're testing a method called `create_main` on the `Category` model, you want to ensure that you are specifically testing that method and its behavior. ### Here are some guidelines: 1. **Te...
32,285
[ { "from": "human", "value": "I have a method on the model Category called create_main used to create main categories. Should I use this method in the before(:each) section even though the method itself has to be tested, or should the main category be created manually using rails built in functionality.\n" ...
I have 3 points (A, B and X) and a distance (d). I need to make a function that tests if point X is closer than distance d to any point on the line segment AB. The question is firstly, is my solution correct and then to come up with a better (faster) solution. My first pass is as follows AX = X-A BX = X-B AB = A-B ...
Your initial solution for checking whether point \(X\) is closer than distance \(d\) to any point on the line segment defined by points \(A\) and \(B\) is quite thorough. Here’s a breakdown of your method and how it might be improved. ### Analysis of Your Method 1. **Checking Distances to Points A and B**: The first ...
26,540
[ { "from": "human", "value": "I have 3 points (A, B and X) and a distance (d). I need to make a function that tests if point X is closer than distance d to any point on the line segment AB. \nThe question is firstly, is my solution correct and then to come up with a better (faster) solution.\nMy first pass i...
I'm trying to run an application using Oracle ADF Business Components on a JBoss Server. I've maneged to deploy it, but when I try to load the page I get below exception: java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection Is there a ...
The `ClassCastException` you're encountering indicates that the ADF Business Components are expecting an `oracle.jdbc.OracleConnection`, but JBoss is providing a wrapped connection (`WrappedConnectionJDK6`) instead. This issue can arise due to how JBoss handles JDBC connections through its resource adapter. To resolve...
29,455
[ { "from": "human", "value": "I'm trying to run an application using Oracle ADF Business Components on a JBoss Server. I've maneged to deploy it, but when I try to load the page I get below exception:\n java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to...
Is there a built-in way to know if a given session variable is a serialized object? Say I retrieve a value like $_SESSION['foo'], but I don't know if it was originally a string or if it is a serialized object. Is there some way to check, or once serialized does PHP just see a string as a string as a string?
In PHP, when you serialize an object, the resulting serialized string does not retain any inherent type information that indicates it was an object. When you store that serialized string in a session variable (or any variable), it is treated as a regular string. Therefore, there is no built-in way in PHP to determine i...
32,882
[ { "from": "human", "value": "Is there a built-in way to know if a given session variable is a serialized object? Say I retrieve a value like $_SESSION['foo'], but I don't know if it was originally a string or if it is a serialized object. Is there some way to check, or once serialized does PHP just see a st...
I'm writing an Excel Addin using COM Interop from .net. I have a command that pops up a dialog, and from the dialog I do some work like collecting data from the used range of several sheets. The problem is that if a cell is in edit mode, some of the calls that I need to make will throw exceptions. I would like a way of...
To determine if Excel is in edit mode before executing your commands in an Excel Add-in using COM Interop, you can utilize the `Application` object's properties. Specifically, you can check if any cell is currently being edited. In Excel, when a cell is in edit mode, the `Application` object exposes the `ActiveCell` p...
31,528
[ { "from": "human", "value": "I'm writing an Excel Addin using COM Interop from .net. I have a command that pops up a dialog, and from the dialog I do some work like collecting data from the used range of several sheets. The problem is that if a cell is in edit mode, some of the calls that I need to make wil...
On the latest Ubuntu, I have a functioning PHP 5.2.4 installation. I want to use a remote Oracle server from PHP using OCI. I've downloaded the "Instant Client Package - Basic Lite" (Link). I've unzipped the package containing the OCI libraries to a dir but I have no idea how to tell PHP that I want to use these libra...
To use Oracle's OCI functions in PHP without recompiling PHP itself, you will need to ensure that you have the proper Oracle Instant Client libraries and that the PHP OCI8 extension is enabled. Here’s a step-by-step guide to get you set up: ### 1. Install the Oracle Instant Client You've already downloaded the "Inst...
26,829
[ { "from": "human", "value": "On the latest Ubuntu, I have a functioning PHP 5.2.4 installation. I want to use a remote Oracle server from PHP using OCI.\nI've downloaded the \"Instant Client Package - Basic Lite\" (Link). I've unzipped the package containing the OCI libraries to a dir but I have no idea ho...
I currently have two text boxes which accept any number. I have a text block that takes the two numbers entered and calculates the average. I was wondering if there was a way I could bind this text block to both text boxes and utilize a custom converter to calculate the average? I currently am catching the text change...
Yes, you can definitely use data binding along with a custom converter to calculate the average of the values entered in two text boxes. This approach is often more efficient and can lead to cleaner code. Below, I'll outline how to implement this in a WPF application. ### Step-by-Step Implementation 1. **Create a Vie...
27,423
[ { "from": "human", "value": "I currently have two text boxes which accept any number. I have a text block that takes the two numbers entered and calculates the average. \nI was wondering if there was a way I could bind this text block to both text boxes and utilize a custom converter to calculate the averag...
Is there a way to run a project inside a solution that has more one project (read: web applications) and avoid the autostart feature of the integrated asp.net webserver in Visual Studio? I have a big solution that has Windows forms projects, Windows Services projects, Web applications, Windows Libraries etc., sometimes...
Yes, you can prevent the auto-start of the integrated ASP.NET development server (IIS Express or Kestrel) for specific web application projects in a Visual Studio solution that contains multiple projects. You can achieve this by changing the project settings. Here are a couple of approaches you can use: ### Method 1: ...
28,751
[ { "from": "human", "value": "Is there a way to run a project inside a solution that has more one project (read: web applications) and avoid the autostart feature of the integrated asp.net webserver in Visual Studio?\nI have a big solution that has Windows forms projects, Windows Services projects, Web appli...
Is there a open source or free suite that can integrate testcases, tests, bugs and possibly the fixes(source code) together. Maintaining the requirements in this system is not a necessity (though, it would be nice to enter a requirement id for each testcase in a custom field). We are a small organization and cannot af...
There are several open-source and free tools that can help you manage test cases, bugs, and potentially integrate with source code fixes. Here are a few options that might suit your needs: 1. **TestLink**: - An open-source test management tool that allows you to create and manage test cases and test suites. You can...
29,431
[ { "from": "human", "value": "\nIs there a open source or free suite that can integrate testcases, tests, bugs and possibly the fixes(source code) together. Maintaining the requirements in this system is not a necessity (though, it would be nice to enter a requirement id for each testcase in a custom field)....
What is the advantages/disadvantages of using inline functions in C++? I see that it only increases performance for the code that the compiler outputs, but with today's optimized compilers, fast CPUs, huge memory etc. (not like in the 1980< where memory was scarce and everything had to fit in 100KB of memory) what adva...
Inline functions in C++ provide several advantages and disadvantages. Let's break these down: ### Advantages of Inline Functions 1. **Reduced Function Call Overhead**: - Inline functions can eliminate the overhead associated with function calls, such as saving registers, pushing arguments onto the stack, and jumpi...
29,910
[ { "from": "human", "value": "What is the advantages/disadvantages of using inline functions in C++? I see that it only increases performance for the code that the compiler outputs, but with today's optimized compilers, fast CPUs, huge memory etc. (not like in the 1980< where memory was scarce and everything...
I am trying to use the following code to write data into an excel file Dim objexcel As Excel.Application Dim wbexcel As Excel.Workbook Dim wbExists As Boolean Set objexcel = CreateObject("excel.Application") objexcel.Visible = True...
The error you are encountering is due to a small mistake in the method you are trying to use to create a new workbook. The correct method to add a new workbook is `Workbooks.Add`, not `Workbook.Add`. Here’s how you can fix your code: ```vba Dim objexcel As Excel.Application Dim wbexcel As Excel.Workbook Dim wbExists A...
34,214
[ { "from": "human", "value": "I am trying to use the following code to write data into an excel file\n Dim objexcel As Excel.Application\n Dim wbexcel As Excel.Workbook\n Dim wbExists As Boolean\n Set objexcel = CreateObject(\"excel.Application\...
What is the optimal number of connections that can be open on a SQL Server 2000 DB. I know in the previous company I was working for, on a tru 64 box with Oracle 8i, 8 processor machine we'd figured out that 8*12= 96 connections seemed to be a good number. Is there any such calc for SQL Server 2000. The DB runs on a 2-...
When determining the optimal number of connections for SQL Server 2000, there are a few factors to consider. SQL Server 2000 does not have a fixed maximum number of connections like some other database systems do. Instead, it is largely dependent on system resources (like CPU, memory, and disk I/O) and the specifics of...
32,475
[ { "from": "human", "value": "What is the optimal number of connections that can be open on a SQL Server 2000 DB. I know in the previous company I was working for, on a tru 64 box with Oracle 8i, 8 processor machine we'd figured out that 8*12= 96 connections seemed to be a good number. Is there any such calc...
I want to get the size of a drive (or UNC path pointing to a partition would be nice, but not required), as well as free space for said drive (or UNC path). This doesn't need to work cross platform; only in Windows. I know it's easy to do in Java 6, but that's not an option; I'm stuck with Java 5. I can get the free s...
In Java 5, since you don't have access to the `java.nio.file` package available in later versions, you can still obtain the total size and free space of a drive or UNC path using the `cmd.exe` command-line interface. You can use the `wmic` command to gather the necessary information. You can run a command like `wmic l...
32,150
[ { "from": "human", "value": "I want to get the size of a drive (or UNC path pointing to a partition would be nice, but not required), as well as free space for said drive (or UNC path). This doesn't need to work cross platform; only in Windows.\nI know it's easy to do in Java 6, but that's not an option; I...
I would like to be able to cast a value dynamically where the type is known only at runtime. Something like this: myvalue = CType(value, "String, Integer or Boolean") The string that contains the type value is passed as an argument and is also read from a database, and the value is stored as string in the database. Is...
Yes, you can achieve this in .NET, although the exact implementation will depend on whether you're using VB.NET or C#. Since you mentioned `CType`, I will focus on VB.NET, but I will also provide you with a C# alternative. ### VB.NET Solution In VB.NET, you can use reflection to convert a value dynamically based on a...
32,746
[ { "from": "human", "value": "I would like to be able to cast a value dynamically where the type is known only at runtime. Something like this:\nmyvalue = CType(value, \"String, Integer or Boolean\")\n\nThe string that contains the type value is passed as an argument and is also read from a database, and the...
I'm sending an email using the dotnet framework. Here is the template that I'm using to create the message: Date of Hire: %HireDate% Annual Salary: %AnnualIncome% Reason for Request: %ReasonForRequest% Name of Voluntary Employee: %FirstName% %LastName% Total Coverage Applied For: %EECoverageAmount% Guaranteed Coverag...
The issue you're encountering with Outlook removing extra line breaks typically arises from the way Outlook handles message formatting. Outlook is known for being quite strict with regards to formatting, especially in the case of plain text messages. Here are several approaches you can take to resolve the line break is...
30,771
[ { "from": "human", "value": "I'm sending an email using the dotnet framework. Here is the template that I'm using to create the message:\nDate of Hire: %HireDate%\nAnnual Salary: %AnnualIncome%\nReason for Request: %ReasonForRequest%\n\nName of Voluntary Employee: %FirstName% %LastName%\nTotal Coverage Appl...
I have an implementation of default handler. When it gets to a   in the character data it stops parsing. Is there any reason that it is doing this? Are there additional properties that I need to set in order for it to deal with &nbsp?
In XML parsing, the `&nbsp;` entity is not recognized as a standard entity because it is an HTML-specific entity (non-breaking space). XML parsers generally don't understand HTML entities unless explicitly defined. When the parser encounters `&nbsp;`, it may stop parsing or throw an error due to the unknown entity. He...
33,152
[ { "from": "human", "value": "I have an implementation of default handler. When it gets to a   in the character data it stops parsing. Is there any reason that it is doing this? Are there additional properties that I need to set in order for it to deal with &nbsp?\n" }, { "from": "gpt", "value": ...
I took the plunge this afternoon and began studying LINQ, so far just mucking around with LINQ on collections. One of the first things I tried was to implement QSort. Now -- ignoring the fact that I could just use an ORDERBY and that this is a very silly qsort implementation -- what I came up with was this: public cla...
Your implementation of QuickSort using LINQ is indeed an interesting exercise in using LINQ for functional programming paradigms. While LINQ is great for querying collections, it is not specifically designed for implementing sorting algorithms, which is a more algorithmic task. That said, you can streamline your code a...
30,107
[ { "from": "human", "value": "I took the plunge this afternoon and began studying LINQ, so far just mucking around with LINQ on collections. One of the first things I tried was to implement QSort.\nNow -- ignoring the fact that I could just use an ORDERBY and that this is a very silly qsort implementation -...
I am calling a SQL proc that has 3 OUTPUT params. After the call to the proc one of the params does not return a value when the other two do. Profiler shows that all 3 values are being returned. The params are declared as follows in the proc... @UsrVariableID INT OUTPUT, @OrganisationName NVARCHAR(256) OUTPUT, @Visible...
The issue you're encountering with the `@OrganisationName` parameter could indeed be related to how parameters are being added and utilized in your SQL procedure call. Let's examine a few potential pitfalls and solutions: ### 1. **Parameter Initialization** You are using `AddWithValue` to add `@OrganisationName` as an...
31,400
[ { "from": "human", "value": "I am calling a SQL proc that has 3 OUTPUT params. After the call to the proc one of the params does not return a value when the other two do. Profiler shows that all 3 values are being returned.\nThe params are declared as follows in the proc...\n@UsrVariableID INT OUTPUT,\n@Org...
I want to get a type of a "BasePage" object that I am creating. Every Page object is based off BasePage. For instance, I have a Login.aspx and in my code-behind and a class that has a method Display: Display(BasePage page) { ResourceManager manager = new ResourceManager(page.GetType()); } In my project structure I...
To get the actual code-behind class type from your ASP.NET page (like `ASP.login_aspx`), you can use reflection to find the type associated with the page. The actual class name you want is the class that inherits from `BasePage`. Here's how you can do it: 1. You can use the `Page.GetType()` method to get the current...
31,037
[ { "from": "human", "value": "I want to get a type of a \"BasePage\" object that I am creating. Every Page object is based off BasePage. For instance, I have a Login.aspx and in my code-behind and a class that has a method Display:\nDisplay(BasePage page) {\n ResourceManager manager = new ResourceManager(...
Looking at adding some data graphing to a new iPhone app in development (ala the Stocks app). I realize I could buckle down and do some Quartz drawing but I'm hoping that someone somewhere has a tip on a Cocoa graphing framework that works on iOS.
There are several Cocoa graphing frameworks available that can help you add data graphing capabilities to your iPhone app without having to rely on manual Quartz drawing. Here are some popular options: 1. **Core Plot**: - Core Plot is a powerful graphing framework that supports both 2D and 3D plotting. It's highly ...
31,002
[ { "from": "human", "value": "Looking at adding some data graphing to a new iPhone app in development (ala the Stocks app).\nI realize I could buckle down and do some Quartz drawing but I'm hoping that someone somewhere has a tip on a Cocoa graphing framework that works on iOS.\n" }, { "from": "gpt",...
I have a client server application that sends XML over TCP/IP from client to server and then broadcast out to other clients. How do i know at what the minimun size of the XML that would warrant a performance improvement by compression the XML rather than sending over the regular stream. Are there any good metrics on t...
Determining the minimum size of XML that warrants performance improvement through compression involves several factors, including the overhead of compression algorithms, network latency, and the characteristics of your XML data. Here are some considerations and metrics to help you evaluate when to use compression: ###...
30,264
[ { "from": "human", "value": "I have a client server application that sends XML over TCP/IP from client to server and then broadcast out to other clients. How do i know at what the minimun size of the XML that would warrant a performance improvement by compression the XML rather than sending over the regula...
I have a CompositeControl that contains a DropDownList. I have set the AutoPostBack property of the DropDownList to true. On the page, I have: <asp:UpdatePanel ID="UpdatePanel" runat="server"> <ContentTemplate> <MyControl:Control ID="CustomControl" runat="server" /> </ContentTemplate> </asp:UpdatePanel>...
The issue you're facing is likely due to the way events and triggers are set up in the `CompositeControl`. Even if you've set `AutoPostBack` to `true` on your `DropDownList`, if the control is not properly registered as a trigger for the `UpdatePanel`, it won't execute an asynchronous postback as expected. Here's how ...
30,477
[ { "from": "human", "value": "I have a CompositeControl that contains a DropDownList.\nI have set the AutoPostBack property of the DropDownList to true.\nOn the page, I have:\n<asp:UpdatePanel ID=\"UpdatePanel\" runat=\"server\">\n <ContentTemplate>\n <MyControl:Control ID=\"CustomControl\" runat=\...
I just wanted to know your experience with using resharper. We have a very heavy dbml file as our database has many tables and every time I need to open up that file I start getting lots of exception coming from resharper. Has anyone had that problem before? If yes, what did you do to fix this very ANNOYING problem?
Many users have reported performance issues and exceptions related to heavy `.dbml` files when using ReSharper, especially in projects with large databases and numerous tables. Here are some common strategies that could help alleviate the problem: 1. **Disable ReSharper Temporarily**: If you're facing significant issu...
32,628
[ { "from": "human", "value": "I just wanted to know your experience with using resharper.\nWe have a very heavy dbml file as our database has many tables and every time I need to open up that file I start getting lots of exception coming from resharper. Has anyone had that problem before? If yes, what did yo...
As the title describes, what are the different doctypes available and what do they mean? I notice that the layout looks a little different in IE7 when I switch from <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > to <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/x...
The `<!DOCTYPE>` declaration, or document type declaration, is an essential part of an HTML or XHTML document. It tells the web browser which version of HTML or XHTML the page is written in, which in turn affects how the page is rendered. Different doctypes can trigger different rendering modes in browsers, especially ...
26,874
[ { "from": "human", "value": "As the title describes, what are the different doctypes available and what do they mean? I notice that the layout looks a little different in IE7 when I switch from \n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" >\n\nto\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHT...
Running VISTA 32bit. I am trying to install c# Visual Express 2008 - but it requires .NET 3.5. One of the prerequisites during the install is .NET 3.5 ... it attempts to install it but fails, with no real error message. So I downloaded .NET 3.5 standalone from MS website and tried that.Again it fails with the error [...
The issues you're facing while trying to install .NET Framework 3.5 on your Windows Vista 32-bit system can be frustrating. Here are several steps you can take to try to resolve the installation problems: ### Step 1: Ensure All Updates Are Installed Make sure that your Windows Vista is fully updated. Sometimes, missin...
29,416
[ { "from": "human", "value": "Running VISTA 32bit.\nI am trying to install c# Visual Express 2008 - but it requires .NET 3.5. One of the prerequisites during the install is .NET 3.5 ... it attempts to install it but fails, with no real error message.\nSo I downloaded .NET 3.5 standalone from MS website and t...
I could use the following: <fileset dir="C:\Program Files\eclipse\plugins\myplugin"> <include name="extraStuff.jar" /> </fileset> But that breaks the build file on someone else's PC who did not install eclipse into the default folder. In my case I can't use basedir without hard folder references. Is there a 'short...
In Apache Ant, you can use properties to make your build file more flexible and portable across different environments. If you're running Ant from within Eclipse, you can leverage the `eclipse.home` property, which usually points to the installation directory of Eclipse. You can define a property to reference the Ecl...
32,032
[ { "from": "human", "value": "I could use the following:\n<fileset dir=\"C:\\Program Files\\eclipse\\plugins\\myplugin\">\n <include name=\"extraStuff.jar\" />\n</fileset>\n\nBut that breaks the build file on someone else's PC who did not install eclipse into the default folder.\nIn my case I can't use ba...
I have a form that kicks off a Response.Redirect to download a file once complete. I also want to hide the form and show a 'thank you' panel before the redirect takes place, however it seems the asp.net engine just does the redirect without doing the 2 tasks before in the following code: if (success) {...
In ASP.NET, when you call `Response.Redirect()`, it does not wait for the page to finish rendering before it performs the redirect. This means any changes you've made to the page, like showing a thank you message, will not be visible to the user because the browser will be redirected immediately. To handle this situat...
32,128
[ { "from": "human", "value": "I have a form that kicks off a Response.Redirect to download a file once complete. I also want to hide the form and show a 'thank you' panel before the redirect takes place, however it seems the asp.net engine just does the redirect without doing the 2 tasks before in the follo...
Say I want to create vb.net application in Visual studio 2005. What is the difference between File->New->Project vs File->New->Web Site? EDIT I am aware that when using New->Project there are many more options available but if one wants to create just .net web application, would it make a any difference what option you...
In Visual Studio 2005, when you choose `File -> New -> Project` versus `File -> New -> Web Site`, you are essentially choosing different approaches to building your web application, and each option has distinct characteristics: ### File -> New -> Project 1. **Project Structure**: - Creates a formal project file (w...
30,273
[ { "from": "human", "value": "Say I want to create vb.net application in Visual studio 2005.\nWhat is the difference between File->New->Project vs File->New->Web Site?\nEDIT\nI am aware that when using New->Project there are many more options available but if one wants to create just .net web application, wo...
I've implemented a few poor solutions for bringing up an AJAX loader before dynamically updating a content DIV, but none seem to be "universal", and I find each time I do it I'm reworking it. If I have a DIV with content that updates depending on what a user clicks on the page, and I want to display the loader over thi...
To create a reusable and flexible AJAX loader that can be displayed over content DIVs during dynamic updates, you can follow a modular approach. This allows you to easily show and hide the loader for different elements on the page without rewriting your code every time. Here’s a simple implementation of such a loader: ...
28,822
[ { "from": "human", "value": "I've implemented a few poor solutions for bringing up an AJAX loader before dynamically updating a content DIV, but none seem to be \"universal\", and I find each time I do it I'm reworking it. If I have a DIV with content that updates depending on what a user clicks on the page...
Several times, while perusing the Boost library's documentation, I've run across return values that are marked "convertible to bool" (search that page for the phrase "convertible to bool", it's about a third of the way down). I once stumbled across an oblique reference to a paper explaining the reason for that, but hav...
The use of return types that are "convertible to bool" rather than returning a simple `bool` in C++ can be traced to a few key ideas related to type flexibility, extensibility, and readability. Here are the reasons and situations in which this approach can be beneficial: ### Reasons for Returning "Convertible to bool"...
29,239
[ { "from": "human", "value": "Several times, while perusing the Boost library's documentation, I've run across return values that are marked \"convertible to bool\" (search that page for the phrase \"convertible to bool\", it's about a third of the way down). I once stumbled across an oblique reference to a ...
There seem to be two bash idioms for redirecting STDOUT and STDERR to a file: fooscript &> foo ... and ... fooscript > foo 2>&1 What's the difference? It seems to me that the first one is just a shortcut for the second one, but my coworker contends that the second one will produce no output even if there's an error ...
The two idioms for redirecting STDOUT and STDERR in Bash do indeed have different behaviors when it comes to handling errors, especially concerning the potential for redirect errors. 1. **Using `&>`**: ```bash fooscript &> foo ``` This syntax is a shorthand that directs both STDOUT and STDERR to the file s...
30,949
[ { "from": "human", "value": "There seem to be two bash idioms for redirecting STDOUT and STDERR to a file:\nfooscript &> foo\n\n... and ...\nfooscript > foo 2>&1\n\nWhat's the difference? It seems to me that the first one is just a shortcut for the second one, but my coworker contends that the second one w...
I am trying to use timerfd_create and timerfd_settime under Debian Linux lenny. The manpage says to include <sys/timerfd.h>. This file cannot be located on my System. According to the Debian Package Search the only packages with a timerfd.h are the linux-headers-* packets. I have installed the packets linux-headers-2....
It seems that you are trying to use the `timerfd` API in Debian Lenny (which is quite an old release), but you're encountering some issues with the availability of the necessary header file and linking against the correct libraries. 1. **Header File**: The `<sys/timerfd.h>` header should indeed be present if your kern...
31,061
[ { "from": "human", "value": "I am trying to use timerfd_create and timerfd_settime under Debian Linux lenny. The manpage says to include <sys/timerfd.h>. This file cannot be located on my System. According to the Debian Package Search the only packages with a timerfd.h are the linux-headers-* packets. \nI h...
I'm using the freeodbc++ library to access data on a MS SQL Server 2000 database (SP3? SP4?). In particular, I'm running a particularly long and nasty stored procedure. I can watch the procedure execute in SQL Profiler, however, it tends to stop processing at a certain point. No error codes or exceptions thrown. If...
The issue you're encountering with your ODBC connection seems to stem from a few potential areas. Here are some troubleshooting steps and considerations to help diagnose and potentially resolve the problem: 1. **Check ODBC Driver Settings**: Make sure you are using the correct ODBC driver for SQL Server. Sometimes usi...
30,313
[ { "from": "human", "value": "I'm using the freeodbc++ library to access data on a MS SQL Server 2000 database (SP3? SP4?). In particular, I'm running a particularly long and nasty stored procedure. I can watch the procedure execute in SQL Profiler, however, it tends to stop processing at a certain point. ...
Working through some programming interview challenges I found online, I had to write an algorithm to reverse a const char * and return a pointer to a new char *. I think I have it, but to make it work properly I had to do some wonky stuff - basically having to account for the null-terminating character myself. Somehow ...
Your implementation for reversing a string is mostly correct, but there are some important points regarding memory management and conventions in C++. Let's go through your code step-by-step: ### Points to Note: 1. **Dynamic Memory Allocation**: You are correctly using `new` to allocate memory for the reversed string,...
30,266
[ { "from": "human", "value": "Working through some programming interview challenges I found online, I had to write an algorithm to reverse a const char * and return a pointer to a new char *. I think I have it, but to make it work properly I had to do some wonky stuff - basically having to account for the nu...
I was reading this thread/post: https://stackoverflow.com/questions/262298/windows-c-ui-technology and am also wondering about a non .NET UI framework. Specifically - prior to .NET having support for serial ports (I can't believe they left that out of the first release of .NET) I was forced to use MFC for an applicati...
MFC (Microsoft Foundation Class Library) has traditionally required that UI updates occur on the main thread (the UI thread) due to the way Windows GUI applications are designed. This means that if you want to update a UI control from a background thread, you generally need to use mechanisms like posting messages or us...
30,993
[ { "from": "human", "value": "I was reading this thread/post: https://stackoverflow.com/questions/262298/windows-c-ui-technology\nand am also wondering about a non .NET UI framework. Specifically - prior to .NET having support for serial ports (I can't believe they left that out of the first release of .NET...
Many languages have a facility to check to see if an Object is of a certain type (including parent subclasses), implemented with 'is' and used like this: if(obj is MyType) Or slightly more tediously you can in other languages check by using the 'as' keyword to do a soft typecast and seeing if the result null. I hav...
Yes, Java has a straightforward way to check if an object is of a certain type using the `instanceof` keyword. This operator allows you to determine whether an object is an instance of a specific class or a subclass thereof. Here's a simple example: ```java if (obj instanceof MyType) { // obj is an instance of My...
35,613
[ { "from": "human", "value": "Many languages have a facility to check to see if an Object is of a certain type (including parent subclasses), implemented with 'is' and used like this:\nif(obj is MyType)\n\nOr slightly more tediously you can in other languages check by using the 'as' keyword to do a soft type...
I have code like this: class RetInterface {...} class Ret1: public RetInterface {...} class AInterface { public: virtual boost::shared_ptr<RetInterface> get_r() const = 0; ... }; class A1: public AInterface { public: boost::shared_ptr<Ret1> get_r() const {...} ... }; This code does not compi...
You're correct that the issue arises from the fact that `boost::shared_ptr<Ret1>` is not derived from `boost::shared_ptr<RetInterface>`, even though `Ret1` is derived from `RetInterface`. This is an important point about smart pointers in C++: they do not exhibit covariance like raw pointers do. In C++, covariant retu...
28,343
[ { "from": "human", "value": "I have code like this:\nclass RetInterface {...}\n\nclass Ret1: public RetInterface {...}\n\nclass AInterface\n{\n public:\n virtual boost::shared_ptr<RetInterface> get_r() const = 0;\n ...\n};\n\nclass A1: public AInterface\n{\n public:\n boost::shared_ptr<Ret1> g...
Anybody in the know of a viewer (or Notepad++ plugin) that can read txt files in a streaming way? I would like to see for example the last 10 lines of a txt file that gets appended continiously.
To view a continuously appended text file and see the last 10 lines in real-time, you can use several methods. Here are a few tools and options, including some that work with Notepad++: ### 1. **Using Notepad++ with a Plugin** - **NppFTP** or **NppDocSwitcher**: While Notepad++ does not natively support real-time f...
32,321
[ { "from": "human", "value": "Anybody in the know of a viewer (or Notepad++ plugin) that can read txt files in a streaming way?\nI would like to see for example the last 10 lines of a txt file that gets appended continiously.\n" }, { "from": "gpt", "value": "To view a continuously appended text f...
I found the discussion on Do you test private method informative. I have decided, that in some classes, I want to have protected methods, but test them. Some of these methods are static and short. Because most of the public methods make use of them, I will probably be able to safely remove the tests later. But for star...
Testing protected methods can indeed be a tricky subject. Let's break down the options you mentioned, discuss best practices, and see if there are any additional strategies you might consider. ### 1. **Testing Through Public Methods** This is often the best practice. By focusing on testing the public interface of your...
30,914
[ { "from": "human", "value": "I found the discussion on Do you test private method informative.\nI have decided, that in some classes, I want to have protected methods, but test them.\nSome of these methods are static and short. Because most of the public methods make use of them, I will probably be able to ...
How can I revert a modified file to its previous revision at a specific commit hash (which I determined via git log and git diff)?
To revert a modified file to its previous revision at a specific commit hash in Git, you can use the `git checkout` command (or `git restore` in newer versions of Git) to check out the version of the file from that commit. Here’s how to do it step by step: 1. **Find the commit hash**: You've already determined the com...
31,644
[ { "from": "human", "value": "How can I revert a modified file to its previous revision at a specific commit hash (which I determined via git log and git diff)?\n" }, { "from": "gpt", "value": "To revert a modified file to its previous revision at a specific commit hash in Git, you can use the `g...
Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious.
Yes, you can convert geographical coordinates (latitude and longitude) to Universal Transverse Mercator (UTM) coordinates in Java using the GeoTools library. GeoTools provides various utilities for handling spatial data, including coordinate transformations. Here's a simple example of how you can achieve this conversi...
25,252
[ { "from": "human", "value": "Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious.\n" }, { "from": "gpt", "value": "Yes, you can convert geographical coordinat...
I am trying to write a tool that can compare a database’s schema to the SQL in an install script. Getting the information from the database is pretty straightforward but I am having a little trouble parsing the install scripts. I have played with a few of the parsers that show up on Google but they seemed somewhat i...
For parsing SQL install scripts, you have a few good options in terms of open-source SQL parsers that are relatively stable and well-documented. Since you're looking for a parser that doesn't focus on database-specific types and syntax, you might find these libraries useful: 1. **sqlparse**: - **Language**: Python ...
29,023
[ { "from": "human", "value": "I am trying to write a tool that can compare a database’s schema to the SQL in an install script. Getting the information from the database is pretty straightforward but I am having a little trouble parsing the install scripts. \nI have played with a few of the parsers that sh...
When I run the following code to test copying a directory, I get a System.IO.IOException when fileInfo.CopyTo method is being called. The error message is: "The process cannot access the file 'C:\CopyDirectoryTest1\temp.txt' because it is being used by another process." It seems like there's a lock on file1 ("C:\Copy...
The `System.IO.IOException` you're encountering is likely due to the fact that the `File.Create(file1)` method opens a file stream for writing, but does not close it, leaving the file locked. When you subsequently try to copy the file, it's still in use, resulting in the IOException. To resolve this issue, you need to...
32,021
[ { "from": "human", "value": "When I run the following code to test copying a directory, I get a System.IO.IOException when fileInfo.CopyTo method is being called. The error message is: \"The process cannot access the file 'C:\\CopyDirectoryTest1\\temp.txt' because it is being used by another process.\" \nI...
When I'm building a java object using JNI methods, in order to pass it in as a parameter to a java method I'm invoking using the JNI invocation API, how do I manage its memory? Here's what I am working with: I have a C object that has a destructor method that is more complex that free(). This C object is to be associ...
To manage the memory associated with your C object when using JNI, you can employ the following strategy: 1. **Use a Java Finalizer**: You can associate your C object with a Java object in such a way that when the Java object is garbage collected, it automatically calls the appropriate C destructor function. To do thi...
32,062
[ { "from": "human", "value": "When I'm building a java object using JNI methods, in order to pass it in as a parameter to a java method I'm invoking using the JNI invocation API, how do I manage its memory? \nHere's what I am working with:\nI have a C object that has a destructor method that is more complex ...
With our next major release we are looking to globalize our ASP.Net application and I was asked to think of a way to keep track of what code has been already worked on in this effort. My thought was to use a custom Attribute and place it on all classes that have been "fixed". What do you think? Does anyone have a be...
Using a custom attribute in your ASP.NET application to mark classes or methods that have been worked on for globalization is a valid approach. Here are some pros and cons to consider: ### Pros: 1. **Easy Tracking**: It allows for easy tracking of what has been worked on simply by looking for the attribute in the code...
27,881
[ { "from": "human", "value": "With our next major release we are looking to globalize our ASP.Net application and I was asked to think of a way to keep track of what code has been already worked on in this effort. \nMy thought was to use a custom Attribute and place it on all classes that have been \"fixed\...
Is there a website I can create an HTML final four bracket? Or is there just HTML out there that will create it automatically and I can just fill in the specifics?
Creating an HTML Final Four bracket can be done in a couple of different ways. You can either use an online tool that allows you to create brackets easily, or you can manually code it using HTML and CSS. Here are some options for both: ### Online Tools 1. **BracketHQ** - [BracketHQ](https://www.brackethq.com/) allows...
28,748
[ { "from": "human", "value": "Is there a website I can create an HTML final four bracket?\nOr is there just HTML out there that will create it automatically and I can just fill in the specifics?\n" }, { "from": "gpt", "value": "Creating an HTML Final Four bracket can be done in a couple of differ...
I'm working through Practical Web 2.0 Appications currently and have hit a bit of a roadblock. I'm trying to get PHP, MySQL, Apache, Smarty and the Zend Framework all working correctly so I can begin to build the application. I have gotten the bootstrap file for Zend working, shown here: <?php require_once('Zend/...
The error you're encountering is due to the `$this->_engine` variable not being properly initialized as a Smarty object before it's being used in the `render()` method. Specifically, it appears that the initialization of the Smarty object is failing or not being executed correctly, causing `$this->_engine` to remain `n...
29,919
[ { "from": "human", "value": "I'm working through Practical Web 2.0 Appications currently and have hit a bit of a roadblock. I'm trying to get PHP, MySQL, Apache, Smarty and the Zend Framework all working correctly so I can begin to build the application. I have gotten the bootstrap file for Zend working, ...
I'm coding a small CMS to get a better understanding of how they work and to learn some new things about PHP. I have however come across a problem. I want to use mod_rewrite (though if someone has a better solution I'm up for trying it) to produce nice clean URLs, so site.com/index.php?page=2 can instead be site.com/to...
It sounds like you're trying to implement pretty URLs using Apache's mod_rewrite and are having trouble updating your `.htaccess` file via PHP. Here are a few things to consider and some potential solutions to your issue: ### Understanding .htaccess and Permissions 1. **File Permissions**: - Setting your `.htacce...
28,825
[ { "from": "human", "value": "I'm coding a small CMS to get a better understanding of how they work and to learn some new things about PHP. I have however come across a problem.\nI want to use mod_rewrite (though if someone has a better solution I'm up for trying it) to produce nice clean URLs, so site.com/i...
<a id="lblShowTimings" runat="server" title='<%# Eval("SHOW_Name") %>' onclick='PopulateTicketDiv(<%#Eval("SHOW_ID") %>)'> <-- this is the problem %#Eval("SHOW_Time") %> </a> Can Eval be passed as an argument to a javascript function? If so whats the syntax?
Yes, you can pass the result of `Eval` as an argument to a JavaScript function in ASP.NET. However, there are a few considerations you need to keep in mind, especially concerning proper quoting and syntax to ensure the generated JavaScript is valid. Here's how you can pass the evaluated value correctly: ```asp <a id=...
32,816
[ { "from": "human", "value": "<a id=\"lblShowTimings\"\n runat=\"server\"\n title='<%# Eval(\"SHOW_Name\") %>'\n onclick='PopulateTicketDiv(<%#Eval(\"SHOW_ID\") %>)'> <-- this is the problem\n %#Eval(\"SHOW_Time\") %>\n</a>\n\nCan Eval be passed as an argument to a javascript function?\nIf so w...
Anyone have any comparative thoughts on these three technologies? Each addresses a different VM, but how do they compare in capabilities?
It sounds like you might be asking about different virtualization technologies that serve various types of virtual machines (VMs). While you haven't specified the three technologies you're considering, I can provide a general framework for comparing virtualization technologies. Here are some aspects to consider: 1. **...
33,435
[ { "from": "human", "value": "Anyone have any comparative thoughts on these three technologies? Each addresses a different VM, but how do they compare in capabilities?\n" }, { "from": "gpt", "value": "It sounds like you might be asking about different virtualization technologies that serve vario...
Does anyone know of a script that can select all text references to URLs and automatically replace them with anchor tags pointing to those locations? For example: http://www.google.com would automatically turn into <a href="http://www.google.com">http://www.google.com</a> Note: I am wanting this because I don't wa...
Certainly! You can use a simple script in JavaScript to achieve this. This script will search the entire text content of a webpage for any URLs and replace them with anchor tags. Here’s an example of how you could do this: ### JavaScript Example You can run the following script in your browser's console or include it...
30,535
[ { "from": "human", "value": "Does anyone know of a script that can select all text references to URLs and automatically replace them with anchor tags pointing to those locations?\nFor example:\n\nhttp://www.google.com \n\nwould automatically turn into\n\n<a href=\"http://www.google.com\">http://www.google.c...
There are a number of email regexp questions popping up here, and I'm honestly baffled why people are using these insanely obtuse matching expressions rather than a very simple parser that splits the email up into the name and domain tokens, and then validates those against the valid characters allowed for name (there'...
Your points about the complexities of email validation and the pitfalls of using overly complicated regular expressions are well taken. In fact, there are valid reasons for preferring a more straightforward parsing method combined with domain validation over regex-based validation. Here are a few considerations that hi...
32,270
[ { "from": "human", "value": "There are a number of email regexp questions popping up here, and I'm honestly baffled why people are using these insanely obtuse matching expressions rather than a very simple parser that splits the email up into the name and domain tokens, and then validates those against the ...
How do I get a list of all the headings in a word document by using VBA?
To get a list of all the headings in a Word document using VBA, you can create a macro that iterates through all the paragraphs in the document and checks their styles. Headings in Word are typically formatted using specific styles like "Heading 1," "Heading 2," etc. Here’s how to do it: 1. Open your Word document. 2...
32,865
[ { "from": "human", "value": "How do I get a list of all the headings in a word document by using VBA?\n" }, { "from": "gpt", "value": "To get a list of all the headings in a Word document using VBA, you can create a macro that iterates through all the paragraphs in the document and checks their ...
On Ubuntu Linux with Gnome, running my Swing application by double clicking on the jar file in Gnomes file browser leads to errors because required libraries that are dynamically loaded via the Java Plugin Framework (residing in subdirectories) are not found. The base libraries for the framework itself are resolved cor...
The issue you are encountering is likely related to the working directory from which the Java application is executed when launched from the Gnome file browser. When you double-click the JAR file, it may not set the working directory to where the JAR file is located, causing the Java Plugin Framework to fail to find it...
31,164
[ { "from": "human", "value": "On Ubuntu Linux with Gnome, running my Swing application by double clicking on the jar file in Gnomes file browser leads to errors because required libraries that are dynamically loaded via the Java Plugin Framework (residing in subdirectories) are not found.\nThe base libraries...
I did it by creating OLE object with Delphi in 2000/NT/XP as following: Voice := CreateOLEObject('SAPI.SpVoice'); Voice.speak(...) But this does not work in Vista, how can I make my program simply speak some text in Vista?
If you're having issues with the SAPI (Speech Application Programming Interface) in Windows Vista using Delphi, it might be due to various changes in security settings, user permissions, or the way OLE automation is handled. However, the method you mentioned should generally still work with slight modifications or cons...
33,292
[ { "from": "human", "value": "I did it by creating OLE object with Delphi in 2000/NT/XP as following:\nVoice := CreateOLEObject('SAPI.SpVoice');\nVoice.speak(...)\n\nBut this does not work in Vista, how can I make my program simply speak some text in Vista?\n" }, { "from": "gpt", "value": "If you...
I want to answer questions about data in Erlang: count things, correlate messages, provide arbitrary statistics. I had thought about resorting to Hadoop for this but is it possible to build a solution in raw Erlang to do rather arbitrary data analysis not necessarily via map/reduce but somehow? I have seen some hint...
Yes, it is certainly possible to perform arbitrary data analysis using Erlang without resorting to Hadoop or MapReduce. While Erlang is primarily known for its concurrent and distributed programming capabilities, it can also be adapted for data analysis tasks. Below are some approaches and ideas that you could consider...
29,668
[ { "from": "human", "value": "I want to answer questions about data in Erlang: count things, correlate messages, provide arbitrary statistics. I had thought about resorting to Hadoop for this but is it possible to build a solution in raw Erlang to do rather arbitrary data analysis not necessarily via map/r...
I have an executable that is started by a windows service, this program will be run on a customers machine and will need to connect to a remote share to perform a particular task. This share is specified by the customer via a UI, so we do not know this in advance meaning it can't be "hard-coded", or the share mapped in...
Connecting to network shares from a Windows service that runs under the Local System account can be challenging due to the security context under which the service operates. Here are several approaches you might consider to address the issue: ### 1. Use a Service Account While you mentioned that using a user account i...
32,818
[ { "from": "human", "value": "I have an executable that is started by a windows service, this program will be run on a customers machine and will need to connect to a remote share to perform a particular task. This share is specified by the customer via a UI, so we do not know this in advance meaning it can'...
I have developed an installer class which removes certain folders from the base dir.However,I also want to remove the entry of another application from add/remove programs through the inst class.Could anyone suggest the solution. Regards, Harsh Suman
To remove an entry of another application from the Add/Remove Programs list in Windows via an installer class, you'll need to modify the Windows Registry. Entries in Add/Remove Programs are typically found under the following registry key: ``` HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall ``` ...
23,947
[ { "from": "human", "value": "I have developed an installer class which removes certain folders from the base dir.However,I also want to remove the entry of another application from add/remove programs through the inst class.Could anyone suggest the solution.\nRegards,\nHarsh Suman\n" }, { "from": "g...
I use a custom color scheme in Visual Studio (black background, gray text, etc.). There a few settings that refuse to change, however. For example, when cursoring through the markup for an aspx page, the current tag defaults to black text, which doesn't work well on my black background. I've previously changed the appr...
It sounds like you've encountered an issue where Visual Studio isn't retaining your color settings correctly, particularly for specific syntax highlighting or font styles after restarting the program. This can indeed be frustrating, especially when working with a custom color scheme that you prefer. Your solution usi...
31,527
[ { "from": "human", "value": "I use a custom color scheme in Visual Studio (black background, gray text, etc.). There a few settings that refuse to change, however. For example, when cursoring through the markup for an aspx page, the current tag defaults to black text, which doesn't work well on my black bac...
I have a string (char) and I want to extract numbers out of it. So I have string: 1 2 3 4 /0 And now I want some variables, so I can use them as integer: a=1, a=2, a=3, a=4 How can I do that?
You can extract numbers from a string in Python using a combination of the `split()` method and list comprehension. Here’s how you can do it: 1. Split the string to separate the numbers. 2. Convert each string number to an integer. 3. Assign them to variables. Here's an example: ```python # Your input string input_s...
33,649
[ { "from": "human", "value": "I have a string (char) and I want to extract numbers out of it.\nSo I have string: 1 2 3 4 /0\nAnd now I want some variables, so I can use them as integer: a=1, a=2, a=3, a=4\nHow can I do that?\n" }, { "from": "gpt", "value": "You can extract numbers from a string i...
It seems pretty silly to me. What don't I get?
It sounds like you're feeling confused or frustrated about something that seems silly to you. Can you provide more context or specifics about what you're referring to? That way, I can help clarify or provide more insight!
35,942
[ { "from": "human", "value": "It seems pretty silly to me. What don't I get?\n" }, { "from": "gpt", "value": "It sounds like you're feeling confused or frustrated about something that seems silly to you. Can you provide more context or specifics about what you're referring to? That way, I can hel...
I have just noticed that a multidimensional array in C# does not implement IEnumerable<T>, while it does implement IEnumerable. For single-dimensional arrays, both IEnumerable<T> and IEnumerable are implemented. Why this difference? If a multi-dimensional array is IEnumerable, surely it should also implement the generi...
The behavior you're observing with arrays in C# is indeed an interesting aspect of the language and its type system. ### Single-Dimensional Arrays Single-dimensional arrays in C# are designed to be more closely integrated with generics. When you create an array like `int[]`, it directly implements both `IEnumerable<i...
33,559
[ { "from": "human", "value": "I have just noticed that a multidimensional array in C# does not implement IEnumerable<T>, while it does implement IEnumerable. For single-dimensional arrays, both IEnumerable<T> and IEnumerable are implemented.\nWhy this difference? If a multi-dimensional array is IEnumerable, ...
How can I fetch images from a server? I've got this bit of code which allows me to draw some images on a canvas. <html> <head> <script type="text/javascript"> function draw(){ var canvas = document.getElementById('canv'); var ctx = canvas.getContext('2d'); for (i=0;i<document.images...
To fetch images from a server continuously and draw them onto a canvas, you can use the Fetch API in JavaScript to retrieve the image data. Here’s how you can modify your existing code to accomplish this: 1. Use `fetch` to get the image data. 2. Convert the response to a Blob and create a local URL for it. 3. Create a...
28,360
[ { "from": "human", "value": "How can I fetch images from a server?\nI've got this bit of code which allows me to draw some images on a canvas.\n<html>\n <head>\n <script type=\"text/javascript\">\n function draw(){\n var canvas = document.getElementById('canv');\n var ctx = canvas.get...
I am working on a winforms html editor with multiple editor windows as each editor window will be written to a database field. I am creating the editor windows as a control array and was hoping to just have one toolbar above them that would handle the events such as apply bold, italic... based on the window I was curre...
In a WinForms application, if you're managing multiple HTML editor windows and want a single toolbar to operate on the currently selected editor, you have a couple of options to keep track of which editor is active. ### Option 1: Using Active Control Reference One way to achieve this is to maintain a reference to the ...
30,692
[ { "from": "human", "value": "I am working on a winforms html editor with multiple editor windows as each editor window will be written to a database field.\nI am creating the editor windows as a control array and was hoping to just have one toolbar above them that would handle the events such as apply bold,...
What is a good way to edit a Web.config file programmatically? I looked into System.Xml but couldn't find any obvious answers.
Editing a `Web.config` file programmatically can be accomplished using the `System.Xml` namespace, which provides classes for manipulating XML files. The `Web.config` file is an XML file, so you can load it, modify it, and save it back. Here's a step-by-step guide to editing the `Web.config` file using `System.Xml`: ...
29,811
[ { "from": "human", "value": "What is a good way to edit a Web.config file programmatically?\nI looked into System.Xml but couldn't find any obvious answers.\n" }, { "from": "gpt", "value": "Editing a `Web.config` file programmatically can be accomplished using the `System.Xml` namespace, which p...
Is it possible to access the crash log over the application? The last.fm client showed me today a "we found a crash log" altert with the option to send it, so I think it must be possible.
Yes, many applications, including the Last.fm client, can generate and access crash logs. When an application crashes, it often creates a log that records the state of the application at the time of the crash, which developers can use to diagnose the issue. If the application you're using has a built-in mechanism for ...
32,361
[ { "from": "human", "value": "Is it possible to access the crash log over the application? The last.fm client showed me today a \"we found a crash log\" altert with the option to send it, so I think it must be possible.\n" }, { "from": "gpt", "value": "Yes, many applications, including the Last.f...
SPListItem.GetFormattedValue seems to have a strange behavior for DateTime fields. It retrieves the DateTime value through SPListItem's indexer which according to this MSDN article returns local time. Here's a snippet from Reflector public string GetFormattedValue(string fieldName) { SPField field = this.Fields.Get...
The behavior you're encountering with `SPListItem.GetFormattedValue` for DateTime fields is a known issue that can lead to confusion, especially when dealing with different time zones. Here’s a breakdown of the problem and a possible workaround. ### Understanding the Behavior 1. **SPListItem Indexer**: When you acces...
29,429
[ { "from": "human", "value": "SPListItem.GetFormattedValue seems to have a strange behavior for DateTime fields.\nIt retrieves the DateTime value through SPListItem's indexer which according to this MSDN article returns local time.\nHere's a snippet from Reflector\npublic string GetFormattedValue(string fiel...
I'm a bit new to jQuery and hope somebody can help me out. I'm trying to change an element (li) to another element (div) after the (li) has been dropped. Sample code: $("#inputEl>li").draggable({ revert: true, opacity: 0.4, helper: "clone" }); $("#dropEl") .droppable({ accept: ".drag", ...
When you use `replaceWith` on the `ui.draggable`, it removes the original `<li>` element from the DOM and replaces it with a `<div>`. This is why you’re seeing the original draggable elements get disabled – they no longer exist in the DOM after you replace them. To convert the `<li>` into a `<div>` while keeping the d...
34,338
[ { "from": "human", "value": "I'm a bit new to jQuery and hope somebody can help me out.\nI'm trying to change an element (li) to another element (div) after the (li) has been dropped.\nSample code:\n$(\"#inputEl>li\").draggable({ \n revert: true, \n opacity: 0.4,\n helper: \"clone\"\n});\n$(\"#drop...
I am using the Entity Framework and Linq to Entities. I have created a small database pattern & framework to implement versioning as well as localization. Every entity now consists of two or three tables, (ie Product, ProductBase & ProductLocal). My linq always includes the following boilerplate code: from o in D...
In order to implement a cleaner LINQ querying experience that allows you to filter entities based on their version status and language, you can leverage extension methods and expression trees. Here’s how you can set this up. ### Step 1: Create Extension Methods You'll need to create extension methods for the filterin...
22,183
[ { "from": "human", "value": "I am using the Entity Framework and Linq to Entities. I have created a small database pattern & framework to implement versioning as well as localization. Every entity now consists of two or three tables, (ie Product, ProductBase & ProductLocal). \nMy linq always includes t...
How do you get a pointer to the .text section of memory for a program from within that program? I also need the length of the section to do a "Flash to Memory" compare as part of a continuous selftest that runs in the background. The toolset automatically generates the linker .cmd file for the tools I'm using, and the...
To obtain a pointer to the `.text` section of memory and its length from within a program on a TI TMS 6713 DSP using Code Composer Studio (CCS) and the linker command file, you can typically use the linker symbols defined in the command file. Here are some steps to achieve this: 1. **Inspect the Linker Command File**:...
19,157
[ { "from": "human", "value": "How do you get a pointer to the .text section of memory for a program from within that program? I also need the length of the section to do a \"Flash to Memory\" compare as part of a continuous selftest that runs in the background.\nThe toolset automatically generates the linke...
I want to find a sql command or something that can do this where I have a table named tblFoo and I want to name it tblFooBar. However, I want the primary key to also be change, for example, currently it is: CONSTRAINT [PK_tblFoo] PRIMARY KEY CLUSTERED And I want a name change to change it to: CONSTRAINT [PK_tblFooBar...
To rename a table and its primary key constraint in SQL Server, and also to update any foreign key constraints associated with that primary key, you will need to follow a systematic approach. Here's a step-by-step guide to achieve this: 1. **Rename the Table**: You can use the `sp_rename` stored procedure to rename t...
23,099
[ { "from": "human", "value": "I want to find a sql command or something that can do this where I have a table named tblFoo and I want to name it tblFooBar. However, I want the primary key to also be change, for example, currently it is:\nCONSTRAINT [PK_tblFoo] PRIMARY KEY CLUSTERED \n\nAnd I want a name chan...
I'm looking at having certain users access one database and other users accessing another database based on the company they belong to. What would be the best way to handle the connection strings and make sure the user connects to the right db when they login? Thanks for any ideas.
When implementing a system where users are segmented by their company and need to access different databases based on that, there are several strategies you can use to manage the connection strings and ensure that users connect to the correct database upon login. Here are some best practices and approaches to consider:...
30,647
[ { "from": "human", "value": "I'm looking at having certain users access one database and other users accessing another database based on the company they belong to. What would be the best way to handle the connection strings and make sure the user connects to the right db when they login?\nThanks for any id...
We want to include data visualization in our desktop GUI (mostly timelines and graphs; clickable, draggable). We want to restrict to open-source, non-copyleft C++ libraries that allow commercial use and are portable across many platforms. Which library can I use? Our GUI is based on WxWidgets.
For your project that requires data visualization in a desktop GUI built with wxWidgets, and with the stipulations of being open-source, non-copyleft, allowing commercial use, and portable across multiple platforms, here are a couple of C++ libraries you might consider: 1. **QCustomPlot**: - **License**: QCustomPlo...
31,291
[ { "from": "human", "value": "We want to include data visualization in our desktop GUI (mostly timelines and graphs; clickable, draggable). We want to restrict to open-source, non-copyleft C++ libraries that allow commercial use and are portable across many platforms. Which library can I use? Our GUI is base...
So I'm building an app that uses win32's SendMessage as IPC. I'm using FindWindow to get the hWnd based on className and windowName. This has all being going fine and dandy until I want to talk to a root (as in child of the desktop) Window that has the same name / class name as other root Windows. Is there an alternati...
If you're dealing with multiple root windows (top-level windows) that have the same class name and window name, `FindWindow` will not be sufficient, as it only retrieves the first matching window it finds. To differentiate between multiple windows that have the same properties, you can use the `EnumWindows` function. T...
29,650
[ { "from": "human", "value": "So I'm building an app that uses win32's SendMessage as IPC.\nI'm using FindWindow to get the hWnd based on className and windowName. This has all being going fine and dandy until I want to talk to a root (as in child of the desktop) Window that has the same name / class name as...
A little help needed. I'm receiving an xml file similar to this: <?xml version="1.0" encoding="utf-16"?> <dc:GRANTEE xsi:schemaLocation="http://www.blahblahblah.com/FullSchema test.xsd " xmlns:dc="http://www.blahblahblah.com/FullSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RPGID>90CU0024</RPGID>...
Importing XML data into SQL Server and shredding it into tables involves several steps, including using `OPENROWSET` to read the XML file and then using the `nodes()` method to navigate the XML structure. Here’s a walkthrough of how you can achieve this with a stored procedure. ### Step 1: Enable `OPENROWSET` (if not ...
22,614
[ { "from": "human", "value": "A little help needed. I'm receiving an xml file similar to this:\n<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<dc:GRANTEE xsi:schemaLocation=\"http://www.blahblahblah.com/FullSchema test.xsd \" xmlns:dc=\"http://www.blahblahblah.com/FullSchema\" xmlns:xsi=\"http://www.w3.org/2...
I saw this quote in this question: MS support is poor, except when you've paid for a support contract... then its very very good. – gbjbaanb This got me thinking. My company has had 2 support incidents with Microsoft a few months ago (before Stack Overflow was live). In both cases, we were pushing the limits ...
Paid support can vary widely in terms of quality and responsiveness, and experiences often depend on the specific issue and the level of support contract you have. Here are some key points to consider based on common experiences with Microsoft support: 1. **Expertise and Knowledge**: When you pay for support, you typi...
31,720
[ { "from": "human", "value": "I saw this quote in this question:\n\nMS support is poor, except when you've\n paid for a support contract... then\n its very very good. – gbjbaanb \n\nThis got me thinking. My company has had 2 support incidents with Microsoft a few months ago (before Stack Overflow was liv...
I need more than the default diff! I have recently purchased "Beyond Compare" and I'd like to integrate it with svn, so its launched when I type: svn diff foo.c How do I do this?
To integrate Beyond Compare with SVN so that it launches when you run `svn diff`, you'll need to configure SVN to use Beyond Compare as its diff tool. Here are the steps to do this: 1. **Find the path to Beyond Compare**: First, make sure you know the path to the Beyond Compare executable on your system. This will var...
32,271
[ { "from": "human", "value": "I need more than the default diff! I have recently purchased \"Beyond Compare\" and I'd like to integrate it with svn, so its launched when I type:\nsvn diff foo.c\nHow do I do this?\n" }, { "from": "gpt", "value": "To integrate Beyond Compare with SVN so that it lau...
I have Apache running on a public-facing Debian server, and am a bit worried about the security of the installation. This is a machine that hosts several free-time hobby projects, so none of us who use the machine really have the time to constantly watch for upstream patches, stay aware of security issues, etc. But I w...
Setting up a secure environment for your Apache server hosting hobby projects is a great idea, especially if you're concerned about security and maintenance. You have a few options to sandbox your applications and minimize risks. Here are some recommendations: ### 1. **Chroot Jails** Chroot jails can be a good option...
27,096
[ { "from": "human", "value": "I have Apache running on a public-facing Debian server, and am a bit worried about the security of the installation. This is a machine that hosts several free-time hobby projects, so none of us who use the machine really have the time to constantly watch for upstream patches, st...
In class, we are all 'studying' databases, and everyone is using Access. Bored with this, I am trying to do what the rest of the class is doing, but with raw SQL commands with MySQL instead of using Access. I have managed to create databases and tables, but now how do I make a relationship between two tables? If I have...
To create a relationship between the two tables `accounts` and `customers`, you need to set up a foreign key constraint. A foreign key in one table points to a primary key in another table, establishing a relationship between the two. In your case, you want each account to be associated with a customer. The `customer_...
27,424
[ { "from": "human", "value": "In class, we are all 'studying' databases, and everyone is using Access. Bored with this, I am trying to do what the rest of the class is doing, but with raw SQL commands with MySQL instead of using Access.\nI have managed to create databases and tables, but now how do I make a ...
As the question implies, I'm looking for a way to programmatically screen grab a given panorama, I.E set a longitude and latitude and POV (pitch, yaw and zoom) and save the grab to the server. So far the most promise has been shown by Using .net to control the google earth com api (http://earth.google.com/comapi/inde...
To programmatically capture street view panoramas based on longitude, latitude, and point of view (pitch, yaw, zoom), while ensuring reliability and scalability, you have several approaches you can consider beyond using the Google Earth COM API or Flash SWF implementations. Here are some suggestions: ### 1. Google Map...
28,522
[ { "from": "human", "value": "As the question implies, I'm looking for a way to programmatically screen grab a given panorama, I.E set a longitude and latitude and POV (pitch, yaw and zoom) and save the grab to the server. So far the most promise has been shown by \n\nUsing .net to control the google earth c...
Given an HTML link like <a href="urltxt" class="someclass" close="true">texttxt</a> how can I isolate the url and the text? Updates I'm using Beautiful Soup, and am unable to figure out how to do that. I did soup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url)) links = soup.findAll('a') for link in links: p...
To isolate the URL and the text from an HTML `<a>` link using Beautiful Soup, you need to use the `get` method to retrieve attributes and the `string` property (or `text` property) to retrieve the text content. Here's a step-by-step approach: 1. Use `soup.find_all` to get all anchor tags. 2. Use the `get` method to ...
33,286
[ { "from": "human", "value": "Given an HTML link like\n<a href=\"urltxt\" class=\"someclass\" close=\"true\">texttxt</a>\n\nhow can I isolate the url and the text? \nUpdates\nI'm using Beautiful Soup, and am unable to figure out how to do that. \nI did \nsoup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url)...
I would like to create an HTML table with row colors changing based on position and content. But instead of alternating every row, I'd like to be able to group rows together, so that I can have some XML like this: <itemlist> <item group="0">Conent...blah blah</item> <item group="0">Content...who cares</item> ...
You can achieve this by using a combination of HTML, CSS, and JavaScript (or a JavaScript framework like jQuery) to dynamically generate the table based on your XML data. Below is a simple example that shows how to create an HTML table where the row colors change based on the `group` attribute in your XML. ### HTML St...
26,759
[ { "from": "human", "value": "I would like to create an HTML table with row colors changing based on position and content. But instead of alternating every row, I'd like to be able to group rows together, so that I can have some XML like this:\n<itemlist>\n <item group=\"0\">Conent...blah blah</item>\n ...
I'm trying to insert a comment character into a string something similar to this: -CreateVideoTracker VT1 "vt name" becomes -CreateVideoTracker VT1 # "vt name" The VT1 word can actually be anything, so I'm using the regex $line =~ s/\-CreateVideoTracker \w/\-CreateVideoTracker \w # /g; which gives me the result: -Cr...
Yes, you can achieve this with a single regex substitution by capturing the desired parts of the string and then rearranging them in the replacement part. You can do this using capturing groups in your regex. Here's how you can do it: ```perl $line =~ s/(-CreateVideoTracker\s+(\w+))/\1 #/; ``` ### Explanation: 1. *...
33,129
[ { "from": "human", "value": "I'm trying to insert a comment character into a string something similar to this:\n-CreateVideoTracker VT1 \"vt name\"\n\nbecomes\n-CreateVideoTracker VT1 # \"vt name\"\n\nThe VT1 word can actually be anything, so I'm using the regex\n$line =~ s/\\-CreateVideoTracker \\w/\\-Crea...
I'm writing a C++ client which is using libcurl for communicating with a PHP script. The communication should be session based, and thus the first task is to login and make the PHP script set up a session. I'm not used to working with sessions either from C++ or PHP. I basically know that it has to do with cookies and ...
Certainly! To manage sessions using libcurl in C++, you will typically need to handle cookies because PHP sessions rely on cookies to maintain state between requests. Here's a simple example that demonstrates how to log in and maintain a session using libcurl. In this example, we will assume you have a PHP script that...
28,778
[ { "from": "human", "value": "I'm writing a C++ client which is using libcurl for communicating with a PHP script.\nThe communication should be session based, and thus the first task is to login and make the PHP script set up a session.\nI'm not used to working with sessions either from C++ or PHP. I basical...
We're building an C# .NET app which will be running on computers sitting inside trucks. We need to talk to Digital IO ports on the truck computers which do not exist on our developer machines, so I need to write a dummy library which will be included in our dev builds, but will be replaced with our actual Digital IO l...
In MSBuild, there are ways to achieve library substitution based on the build configuration. You can use conditional references in your project file to replace the dummy library with the actual library when you switch between development and release configurations. Here’s how you can accomplish this: ### Step 1: Crea...
31,518
[ { "from": "human", "value": "We're building an C# .NET app which will be running on computers sitting inside trucks. We need to talk to Digital IO ports on the truck computers which do not exist on our developer machines, so I need to write a dummy library which will be included in our dev builds, but will...
I have problems with bringing a windows mobile 6 form to the front. I tried things like this already Form1 testForm = new Form1(); testForm.Show(); testForm.BringToFront(); testForm.Focus(); But it's always behind the form that includes that code. The only things that have worked for me are testForm.TopMost = true; o...
In Windows Mobile 6 development, showing a new form in front of an existing one can sometimes be tricky because of the way the Windows Forms API manages window focus. Here’s how you can achieve bringing a new form to the front without making it modal or using the `TopMost` property. Here’s a method you can use: 1. **...
32,819
[ { "from": "human", "value": "I have problems with bringing a windows mobile 6 form to the front.\nI tried things like this already\nForm1 testForm = new Form1();\ntestForm.Show();\ntestForm.BringToFront();\ntestForm.Focus();\n\nBut it's always behind the form that includes that code.\nThe only things that h...
The IntelliJ IDEA short-cut to reformat source code is Ctrl+Alt+L. This happens to lock the screen in KDE (Gnome too?). How can I disable this so IntelliJ receives the key sequence?
To resolve the conflict between the IntelliJ IDEA keyboard shortcut (Ctrl + Alt + L) and the lock screen shortcut in KDE (and possibly Gnome), you will need to disable or change the lock screen shortcut. Here’s how you can do this in both environments: ### For KDE: 1. **Open System Settings**: - Click on the appli...
29,702
[ { "from": "human", "value": "The IntelliJ IDEA short-cut to reformat source code is Ctrl+Alt+L. This happens to lock the screen in KDE (Gnome too?). How can I disable this so IntelliJ receives the key sequence?\n" }, { "from": "gpt", "value": "To resolve the conflict between the IntelliJ IDEA ...
I'm just a one-man software shop, and I currently have an MSDN subscription. It is coming up for renewal soon, and it looks like it's going to cost a small fortune. I see that TechNet subscriptions cost significantly less money, and seem to include all of the same software. Am I missing something here? What is the diff...
Yes, there are significant differences between MSDN (Microsoft Developer Network) and TechNet subscriptions, despite both offering access to a range of Microsoft software. ### MSDN Subscription: 1. **Target Audience**: MSDN subscriptions are primarily aimed at software developers. They provide tools, services, and res...
31,703
[ { "from": "human", "value": "I'm just a one-man software shop, and I currently have an MSDN subscription. It is coming up for renewal soon, and it looks like it's going to cost a small fortune. I see that TechNet subscriptions cost significantly less money, and seem to include all of the same software. Am I...
I have a fingerprint image taken from a sliding scanner. However the output does not have clean background. It looks like this: dirty http://img208.imageshack.us/img208/2622/dirtyie0.png I want to remove the background so that further processing will be more accurate. Something like this: cleaned http://img515.imagesha...
To clean up the fingerprint image and remove the background noise, you can use several image processing techniques. Here’s a step-by-step guide: 1. **Convert to Grayscale**: If the image is in color, convert it to a grayscale image. This simplifies the processing by reducing the number of channels. 2. **Thresholding*...
30,930
[ { "from": "human", "value": "I have a fingerprint image taken from a sliding scanner. However the output does not have clean background. It looks like this:\ndirty http://img208.imageshack.us/img208/2622/dirtyie0.png\nI want to remove the background so that further processing will be more accurate. Somethin...
Is there an official C# guideline for the order of items in terms of class structure? Does it go: Public Fields Private Fields Properties Constructors Methods ? I'm curious if there is a hard and fast rule about the order of items? I'm kind of all over the place. I want to stick with a particular standard so I can do...
While there isn't a strict, universally enforced guideline for the order of items in a C# class structure, there are some commonly accepted conventions that many developers follow to maintain readability and consistency. Adopting a standard structure can greatly improve the maintainability of your code. ### Commonly F...
28,968
[ { "from": "human", "value": "Is there an official C# guideline for the order of items in terms of class structure?\nDoes it go:\n\nPublic Fields\nPrivate Fields\nProperties\nConstructors\nMethods\n?\n\nI'm curious if there is a hard and fast rule about the order of items? I'm kind of all over the place. I w...
After reading an article about the subject from O'Reilly, I wanted to ask Stack Overflow for their thoughts on the matter.
It seems like you're looking to engage the Stack Overflow community regarding a specific topic you read about in an O'Reilly article. To get the best responses, consider the following steps: 1. **Summarize the Article**: Briefly summarize the main points or arguments made in the O'Reilly article. This will provide con...
34,633
[ { "from": "human", "value": "After reading an article about the subject from O'Reilly, I wanted to ask Stack Overflow for their thoughts on the matter.\n" }, { "from": "gpt", "value": "It seems like you're looking to engage the Stack Overflow community regarding a specific topic you read about i...
I used to understand "beta" as "feature-complete". Web applications rarely are ever feature-complete and rather evolve slowly with time. So does "beta" have any specific meaning with them or is it just a gimmick?
The term "beta" in the context of web applications has indeed evolved over time and can carry different meanings depending on the context and the company's philosophy. Traditionally, "beta" referred to a stage of software development that followed alpha and precedes the official release (or "stable" version). In this c...
33,787
[ { "from": "human", "value": "I used to understand \"beta\" as \"feature-complete\". Web applications rarely are ever feature-complete and rather evolve slowly with time. So does \"beta\" have any specific meaning with them or is it just a gimmick?\n" }, { "from": "gpt", "value": "The term \"beta...
I'm working on a firefox extension and have been developing it in Firefox 3, I went to test it on Firefox 2 and for some reason, none of my HTTP requests is firing. The format of the requests are below (using prototype): theResponse = function(response){ //some code } new Ajax.Request(url,{ method:'get', p...
The issue you're experiencing is likely related to differences in how Firefox 2 and Firefox 3 handle cross-domain (or cross-site) AJAX requests. Firefox 2 has stricter cross-origin request policies compared to Firefox 3, and if your requests are going to a different domain or protocol (like from HTTP to HTTPS), they ma...
31,254
[ { "from": "human", "value": "I'm working on a firefox extension and have been developing it in Firefox 3, I went to test it on Firefox 2 and for some reason, none of my HTTP requests is firing. The format of the requests are below (using prototype):\ntheResponse = function(response){\n //some code\n}\n\n...
In many languages there's a pair of functions, chr() and ord(), which convert between numbers and character values. In some languages, ord() is called asc(). Ruby has Integer#chr, which works great: >> 65.chr A Fair enough. But how do you go the other way? "A".each_byte do |byte| puts byte end prints: 65 and that...
In Ruby, if you want to convert a character to its corresponding ASCII value without using a loop, you can use the `ord` method directly on the string. Here's how you can do it: ```ruby A = "A".ord ``` This will assign the ASCII value of the character "A" (which is 65) to the constant `A`. If you want to declare co...
35,570
[ { "from": "human", "value": "In many languages there's a pair of functions, chr() and ord(), which convert between numbers and character values. In some languages, ord() is called asc().\nRuby has Integer#chr, which works great:\n>> 65.chr\nA\n\nFair enough. But how do you go the other way?\n\"A\".each_byte...
I have a mature MFC C++ application that displays on screen and prints using CDC wrappings on the Win32 GDI. While it has been optimized over the years, I would like to replace it with something a bit faster. The graphics included rendered triangular surface models, complex polylines and polygons, and lots of text. ...
Given your requirements for a rendering SDK that can replace your mature MFC C++ application, here are several potential options that you might consider. Each one has its pros and cons based on the criteria you've specified: ### 1. **OpenGL with GLM (OpenGL Mathematics Library)** **Pros:** - **High Performance:** Ope...
27,403
[ { "from": "human", "value": "I have a mature MFC C++ application that displays on screen and prints using CDC wrappings on the Win32 GDI. While it has been optimized over the years, I would like to replace it with something a bit faster. The graphics included rendered triangular surface models, complex po...