instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I have a need to display many numerical values in columns. These values need to be easily editable so I cannot just display them in a table. I am using textboxes to display them. Is there a way for me to right-justify the text displayed in a textbox? It would also be nice if when the user is entering data for it to sta...
Yes, you can right-justify text in a textbox and also make the text entry start from the right side (i.e., right-aligned) depending on the programming framework or library you are using. Below are examples for different environments: ### HTML/CSS If you are using HTML with CSS, you can achieve right-justification in a...
23,579
[ { "from": "human", "value": "I have a need to display many numerical values in columns. These values need to be easily editable so I cannot just display them in a table. I am using textboxes to display them. Is there a way for me to right-justify the text displayed in a textbox? It would also be nice if whe...
I noticed today that in D2009 (with update 1), TStringStream.ReadString does not move the Position in the Stream anymore like it used to do up to D2007. So, looping on MyStringStream.ReadString(10) would always read the 1st 10 chars of the stream instead of moving along and getting all the stream 10 chars by 10 chars. ...
It appears that you've encountered a behavior change in the `TStringStream.ReadString` method between Delphi 2007 and Delphi 2009. In Delphi 2007, `ReadString` would indeed update the stream's position after reading a specified number of characters, while in Delphi 2009, it seems that it does not. This change can be ...
28,009
[ { "from": "human", "value": "I noticed today that in D2009 (with update 1), TStringStream.ReadString does not move the Position in the Stream anymore like it used to do up to D2007.\nSo, looping on MyStringStream.ReadString(10) would always read the 1st 10 chars of the stream instead of moving along and get...
I dont find any usefull website according to this API. What's the format of the String? The content? Thanks
It seems like you're looking for information about a specific API, including the format of the string it returns and its content. However, I need more context to provide accurate assistance. Could you please specify which API you are referring to? Additionally, if you can provide any details about the expected output...
29,337
[ { "from": "human", "value": "I dont find any usefull website according to this API.\nWhat's the format of the String? The content?\nThanks\n" }, { "from": "gpt", "value": "It seems like you're looking for information about a specific API, including the format of the string it returns and its con...
I have two XmlDocuments and I would like to move an XmlNode selected from one of the documents and append it at a particular location in the other document. The naively intuitive approach of simply calling AppendNode(xmlNodeFromDocument1) at the appropriate place of document 2, of course doesn't work because the method...
Indeed, when working with `XmlDocument` objects in C#, directly appending a node from one document to another won't work because an `XmlNode` belongs to the document it was created in, and cannot be directly moved to another document. To move a node from one `XmlDocument` to another, you need to import the node into t...
24,875
[ { "from": "human", "value": "I have two XmlDocuments and I would like to move an XmlNode selected from one of the documents and append it at a particular location in the other document.\nThe naively intuitive approach of simply calling AppendNode(xmlNodeFromDocument1) at the appropriate place of document 2,...
Is there a framework equivalent to Guice (http://code.google.com/p/google-guice) for Python?
Yes, there are several dependency injection frameworks for Python that are similar to Google Guice. Here are a few notable ones: 1. **Injector**: This is a popular dependency injection framework for Python that is inspired by Guice. It allows you to define how dependencies should be provided and automatically resolves...
24,656
[ { "from": "human", "value": "Is there a framework equivalent to Guice (http://code.google.com/p/google-guice) for Python?\n" }, { "from": "gpt", "value": "Yes, there are several dependency injection frameworks for Python that are similar to Google Guice. Here are a few notable ones:\n\n1. **Inje...
I'm looking at the code for a phase accumulator, and I must be a simpleton because I don't get it. The code is simple enough: Every Clock Tick do: accum = accum + NCO_param; return accum; accum is a 32-bit register. Obviously, at some point it will roll-over. My question really is: How does this relate to ...
The code you've provided describes a simple phase accumulator, commonly used in systems like numerically controlled oscillators (NCOs) or digital signal processing to generate waveforms. Let's break down how it relates to phase. ### What is a Phase Accumulator? A phase accumulator keeps track of a phase value that re...
21,039
[ { "from": "human", "value": "I'm looking at the code for a phase accumulator, and I must be a simpleton because I don't get it.\nThe code is simple enough:\n\n Every Clock Tick do:\n accum = accum + NCO_param;\n return accum;\n\naccum is a 32-bit register. Obviously, at some point it will roll-over....
I would like to learn more about C++0x. What are some good references and resources? Has anyone written a good book on the subject yet?
C++0x is the informal name for the C++ programming language standard that introduced a number of significant features, which later became formalized in C++11. Here are some resources and references that can help you learn about C++0x and its features: ### Books 1. **"The C++ Programming Language" by Bjarne Stroustrup*...
25,227
[ { "from": "human", "value": "I would like to learn more about C++0x. What are some good references and resources? Has anyone written a good book on the subject yet?\n" }, { "from": "gpt", "value": "C++0x is the informal name for the C++ programming language standard that introduced a number of s...
The question I'm really asking is why require does not take the name of the gem. Also, In the case that it doesn't, what's the easiest way to find the secret incantation to require the damn thing!? As an example if I have memcache-client installed then I have to require it using require 'rubygems' require 'memcache'
The behavior you're encountering with requiring gems in Ruby has to do with how the gem is structured and named. Sometimes, the name of the gem and the name you need to use in your `require` statement are different. This can happen for various reasons: 1. **Different Name Convention**: The gem might have a different i...
25,403
[ { "from": "human", "value": "The question I'm really asking is why require does not take the name of the gem. Also, In the case that it doesn't, what's the easiest way to find the secret incantation to require the damn thing!?\nAs an example if I have memcache-client installed then I have to require it usin...
On mac os console, when doing paste of large quantities of text (for example an sql database) I get loads of trash and corrupted text. But when doing the same under windows or into a text box, this doesn't happen and the text comes out ok. Is this a buffer problem or something like it? If so anyone know any flag to mak...
When you experience issues with pasting large quantities of text in the macOS console, it may be related to several factors, including buffer limits, terminal settings, or character encoding. Here are some steps and suggestions to address the problem: 1. **Use a Different Terminal Application**: - Instead of the d...
24,303
[ { "from": "human", "value": "On mac os console, when doing paste of large quantities of text (for example an sql database) I get loads of trash and corrupted text. But when doing the same under windows or into a text box, this doesn't happen and the text comes out ok.\nIs this a buffer problem or something ...
Is there a generic way to clone objects in VBA? So that i could copy x to y instead of copying just the pointer? Dim x As New Class1 Dim y As Class1 x.Color = 1 x.Height = 1 Set y = x y.Color = 2 Debug.Print "x.Color=" & x.Color & ", x.Height=" & x.Height By generic i mean something like Set y = Clone...
In VBA, there isn't a built-in method to clone objects generically, like `Set y = CloneObject(x)`. However, you can implement a cloning mechanism using reflection, or you can create your own method for each class to handle cloning. Since VBA does not support reflection natively, the most straightforward approach would ...
25,461
[ { "from": "human", "value": "Is there a generic way to clone objects in VBA? So that i could copy x to y instead of copying just the pointer?\n Dim x As New Class1\n Dim y As Class1\n\n x.Color = 1\n x.Height = 1\n\n Set y = x\n y.Color = 2\n\n Debug.Print \"x.Color=\" & x.Color & \", x.Height=\" & x...
I know how to write trace statements that I can view in a webforms environment, but how do I do this in a windows forms app? I am inside of a static method, and I want to display the sql query that it is generating. I don't have access to messagebox.show, what are my options?
In a Windows Forms application, if you don't have access to `MessageBox.Show`, there are still several ways you can log or display trace statements, especially in the context of a static method. Here are some options: ### 1. Use `Debug.WriteLine` If you are running your application in Debug mode, you can use `Debug.Wr...
21,309
[ { "from": "human", "value": "I know how to write trace statements that I can view in a webforms environment, but how do I do this in a windows forms app?\nI am inside of a static method, and I want to display the sql query that it is generating.\nI don't have access to messagebox.show, what are my options?\...
I have a control where I have to check in which page I am, so I can set a certain variable accordingly. string pageName = this.Page.ToString(); switch (pageName) { case "ASP.foo_bar_aspx": doSomething(); break; default: doSomethingElse(); break; } this works fine locally and on some developmentservers, however when I ...
The behavior you're observing with the page name changing from `ASP.foo_bar_aspx` to `_ASP.foo_bar_aspx` typically occurs in ASP.NET applications when there is a difference in the compilation mode or environment between your development and production servers. ### Explanation of the Underscore Prefix 1. **ASP.NET Com...
25,221
[ { "from": "human", "value": "I have a control where I have to check in which page I am, so I can set a certain variable accordingly.\nstring pageName = this.Page.ToString();\nswitch (pageName)\n{\ncase \"ASP.foo_bar_aspx\": doSomething(); break;\ndefault: doSomethingElse(); break;\n}\n\nthis works fine loca...
Actually, I'm using this way. Do you have a better way? private bool AcceptJson(HttpRequest request) { const string JsonType = "application/json"; if (request.ContentType.ToLower(CultureInfo.InvariantCulture).StartsWith(JsonType)) { return true; } if (request.AcceptTypes.Select(t => t.ToLo...
Your method for determining if a request should be accepted as JSON is functional, but it can be simplified and made more efficient. Here are a couple of improvements you could implement: 1. **Combine Conditions**: Instead of checking the `ContentType` and `AcceptTypes` separately, you could encapsulate both checks in...
22,313
[ { "from": "human", "value": "Actually, I'm using this way. Do you have a better way?\nprivate bool AcceptJson(HttpRequest request)\n{\n const string JsonType = \"application/json\";\n\n if (request.ContentType.ToLower(CultureInfo.InvariantCulture).StartsWith(JsonType))\n {\n return true;\n ...
In a nutshell, there's a global stylesheet: a { font-family: Arial; } I want to use a different font family for a particular link: <a href="..." style="font-family: Helvetica;">...</a> or <span style="font-family: Helvetica;"><a href="...">...</a></span> but nothing works. Is there an easy way to do this? P.S. I'm d...
If the inline style for the link isn't overriding the global stylesheet, it could be due to the specificity or how the styles are being applied. Inline styles generally have a higher specificity than external stylesheets, so using them should normally work. However, there are a couple of things to check and some potent...
18,995
[ { "from": "human", "value": "In a nutshell, there's a global stylesheet:\na { font-family: Arial; }\n\nI want to use a different font family for a particular link:\n<a href=\"...\" style=\"font-family: Helvetica;\">...</a>\n\nor\n<span style=\"font-family: Helvetica;\"><a href=\"...\">...</a></span>\n\nbut ...
I'd like to have comments in my code, but I want them to be removed before deploying. Yes, it's not hard to write such a thing, but if it already exists… And how about comments in ASP pages?
There are indeed tools and techniques available to help you remove comments from your code before deployment, and many build systems and continuous integration (CI) pipelines can automate this process. ### Tools to Remove Comments 1. **Preprocessors**: Some languages support preprocessors that allow you to strip comm...
21,613
[ { "from": "human", "value": "I'd like to have comments in my code, but I want them to be removed before deploying.\nYes, it's not hard to write such a thing, but if it already exists…\nAnd how about comments in ASP pages?\n" }, { "from": "gpt", "value": "There are indeed tools and techniques ava...
I'm currently learning Haskell, Which language (F# or Haskell) do you prefer for programming general purpose applications? Which do you think is the stronger language?
The choice between Haskell and F# for programming general-purpose applications largely depends on several factors, including your specific use case, personal preferences, and the context in which you're developing. ### Haskell - **Strengths**: - **Purely Functional**: Haskell is a purely functional programming langu...
23,021
[ { "from": "human", "value": "I'm currently learning Haskell, Which language (F# or Haskell) do you prefer for programming general purpose applications?\nWhich do you think is the stronger language?\n" }, { "from": "gpt", "value": "The choice between Haskell and F# for programming general-purpose...
What is the equivalent to the C# "!" operator in F#?
In C#, the `!` operator is used to denote the logical negation (not) operation, and it is also used in a different context to dereference nullable types or to indicate that a value is non-null (null-forgiving operator). In F#, the equivalent for logical negation is the `not` function. Here’s how you can use it in F#: ...
26,985
[ { "from": "human", "value": "What is the equivalent to the C# \"!\" operator in F#?\n" }, { "from": "gpt", "value": "In C#, the `!` operator is used to denote the logical negation (not) operation, and it is also used in a different context to dereference nullable types or to indicate that a valu...
What translation occurs when writing to a file that was opened in text mode that does not occur in binary mode? Specifically in MS Visual C. unsigned char buffer[256]; for (int i = 0; i < 256; i++) buffer[i]=i; int size = 1; int count = 256; Binary mode: FILE *fp_binary = fopen(filename, "wb"); fwrite(buffer, size, c...
When you write to a file that has been opened in text mode as opposed to binary mode in MS Visual C, there are certain translation and interpretation behaviors that differ between the two modes. Specifically, when writing to a file in text mode, certain special character translations are applied. Here are the key diffe...
23,808
[ { "from": "human", "value": "What translation occurs when writing to a file that was opened in text mode that does not occur in binary mode? Specifically in MS Visual C.\nunsigned char buffer[256];\nfor (int i = 0; i < 256; i++) buffer[i]=i;\nint size = 1;\nint count = 256;\n\nBinary mode:\nFILE *fp_binary...
What do you think of using a metric of function point to lines of code as a metric? It makes me think of the old game show "Name That Tune". "I can name that tune in three notes!" I can write that functionality in 0.1 klocs! Is this useful? It would certainly seem to promote library usage, but is that what you want?...
Using a metric that compares function points to lines of code (LOC) can indeed provide interesting insights into software development, similar to the concept of “Name That Tune.” However, the utility of such a metric comes with caveats. ### Pros of Function Points to LOC Metrics: 1. **Measuring Productivity**: This r...
24,860
[ { "from": "human", "value": "What do you think of using a metric of function point to lines of code as a metric?\nIt makes me think of the old game show \"Name That Tune\". \"I can name that tune in three notes!\" I can write that functionality in 0.1 klocs! Is this useful?\nIt would certainly seem to pr...
I have some data with messed-up accented characters. For example in the data we have things like ClΘmentine that should should read Clémentine I'd like to clean it up with a script, but when I do this for example Select Replace('ClΘmentine', 'Θ', 'é') this is what I get: Clémenéine Apparently Θ matches both Θ and t....
The issue you are encountering is likely related to the character encoding used in your database or programming environment. The character `Θ` (Greek capital letter Theta) is being incorrectly interpreted in place of the expected `t`, which leads to the replacement not working as intended. ### Steps to Resolve the Iss...
21,659
[ { "from": "human", "value": "I have some data with messed-up accented characters. For example in the data we have things like\nClΘmentine\nthat should should read\nClémentine\nI'd like to clean it up with a script, but when I do this for example\n Select Replace('ClΘmentine', 'Θ', 'é')\n\nthis is what I ge...
I'm working in Java with XML and I'm wondering; what's the difference between an element and a node?
In the context of XML and its manipulation in Java (or any other programming language), the terms "element" and "node" have specific meanings that relate to the structure of XML documents. Here's a breakdown of the differences: ### Element - **Definition**: An element is a specific type of node in an XML document. It ...
23,310
[ { "from": "human", "value": "I'm working in Java with XML and I'm wondering; what's the difference between an element and a node?\n" }, { "from": "gpt", "value": "In the context of XML and its manipulation in Java (or any other programming language), the terms \"element\" and \"node\" have speci...
What does this mean exactly? I'm doing something like this: File.Copy(@"\\foo\bar\baz.txt", @"c:\test\baz.txt"); MSDN doesn't describe this exception except in general terms, and googling around just yields tables of error codes. I've confirmed the source file exists, and I'm 99% sure that I have the permissions to c...
In the context of the `File.Copy` method in C#, if you encounter an exception when trying to copy a file, it can be due to several reasons. Since you confirmed the source file exists and you believe you have the necessary permissions, here are some common causes to investigate further: 1. **File in Use**: The source f...
25,365
[ { "from": "human", "value": "What does this mean exactly? I'm doing something like this:\nFile.Copy(@\"\\\\foo\\bar\\baz.txt\", @\"c:\\test\\baz.txt\");\n\nMSDN doesn't describe this exception except in general terms, and googling around just yields tables of error codes.\nI've confirmed the source file ex...
So what I have right now is something like this: PropertyInfo[] info = obj.GetType().GetProperties(BindingFlags.Public); where obj is some object. The problem is some of the properties I want aren't in obj.GetType() they're in one of the base classes further up. If I stop the debugger and look at obj, the I have to d...
To retrieve all properties from an object, including those defined in its base classes, you can use `GetProperties` with a combination of `BindingFlags` that includes both public and non-public properties, and you also need to iterate through the type hierarchy. The `BindingFlags` you might want to use are: - `Binding...
25,532
[ { "from": "human", "value": "So what I have right now is something like this:\nPropertyInfo[] info = obj.GetType().GetProperties(BindingFlags.Public);\n\nwhere obj is some object.\nThe problem is some of the properties I want aren't in obj.GetType() they're in one of the base classes further up. If I stop ...
An old Direct3D book says "...you can achieve an acceptable frame rate with hardware acceleration while displaying between 2000 and 4000 polygons per frame..." What is one polygon in Direct3D? Do they mean one primitive (indexed or otherwise) or one triangle?
In the context of Direct3D (and graphics programming in general), when referring to "one polygon," it typically means one triangle, as triangles are the fundamental building blocks of 3D graphics rendering. Polygons can refer to any multi-sided shape, but in most 3D rendering pipelines, including Direct3D, complex sh...
27,663
[ { "from": "human", "value": "An old Direct3D book says \n\n\"...you can achieve an acceptable frame\n rate with hardware acceleration while\n displaying between 2000 and 4000\n polygons per frame...\"\n\nWhat is one polygon in Direct3D? Do they mean one primitive (indexed or otherwise) or one triangle?\n...
This is the css for setting the color for h1 text that is linked: .nav-left h1 a, a:visited { color: #055830; } <div class="nav-left"> <h1><a href="/index.php/housing/">Housing</a></h1> </div> It does not look like it is working appropriately, any help is appreciated.
It looks like you have a CSS rule for setting the color of the `<a>` element within the `<h1>`. However, there are a couple of issues that may be causing your style not to work as expected: 1. **Specificity**: Your selector might not be specific enough, especially if there are other styles applied to links (`<a>`) tha...
25,465
[ { "from": "human", "value": "This is the css for setting the color for h1 text that is linked:\n\n\n.nav-left h1 a,\r\na:visited {\r\n color: #055830;\r\n}\n<div class=\"nav-left\">\r\n <h1><a href=\"/index.php/housing/\">Housing</a></h1>\r\n</div>\n\n\n\nIt does not look like it is working appropriately,...
What would be the best way to fill an array from user input? Would a solution be showing a prompt message and then get the values from from the user?
Yes, prompting the user for input is a common and effective way to fill an array in programming. Here’s a general approach that can be applied in many programming languages: ### Step-by-Step Approach: 1. **Initialize an Empty Array**: Create an array to hold the values. 2. **Determine the Size of the Array**: Ask the...
24,140
[ { "from": "human", "value": "What would be the best way to fill an array from user input?\nWould a solution be showing a prompt message and then get the values from from the user?\n" }, { "from": "gpt", "value": "Yes, prompting the user for input is a common and effective way to fill an array in...
Is there a pure-Java equivalent to <jsp:forward page="..." /> that I can use within a <% ... %> block? For example, I currently have a JSP page something like this: <% String errorMessage = SomeClass.getInstance().doSomething(); if (errorMessage != null) { session.setAttribute("error", errorMessage); %>...
Yes, you can achieve the same functionality as `<jsp:forward page="..." />` in pure Java within your `<% ... %>` scriptlet by using the `RequestDispatcher` interface provided by the Servlet API. This approach allows you to keep your logic within a single block without breaking out to the JSP tag syntax. Here's how you...
26,363
[ { "from": "human", "value": "Is there a pure-Java equivalent to <jsp:forward page=\"...\" /> that I can use within a <% ... %> block?\nFor example, I currently have a JSP page something like this:\n<%\n String errorMessage = SomeClass.getInstance().doSomething();\n if (errorMessage != null) {\n ...
I have this: public string Log { get { return log; } protected set { if (log != value) { MarkModified(PropertyNames.Log, log); log = value; } } } And my utility class...
To determine if a property has a public setter, you can use the `GetSetMethod` method of the `PropertyInfo` class, which allows you to check the accessibility of the property's setter method. Here's how you can modify your existing code to check for a public setter: ```csharp PropertyInfo pi = ReflectionHelper.GetProp...
26,337
[ { "from": "human", "value": "I have this:\npublic string Log\n {\n get { return log; }\n protected set\n {\n if (log != value)\n {\n MarkModified(PropertyNames.Log, log);\n log = value;\n ...
We try to convert from string to Byte[] using the following Java code: String source = "0123456789"; byte[] byteArray = source.getBytes("UTF-16"); We get a byte array of length 22 bytes, we are not sure where this padding comes from. How do I get an array of length 20?
The issue you're encountering arises from the way the UTF-16 encoding works. In UTF-16, each character is typically represented using 2 bytes (16 bits), and the encoding includes a Byte Order Mark (BOM) in some cases, which adds an additional 2 bytes at the start of the byte array. In the example you provided: ```jav...
22,757
[ { "from": "human", "value": "We try to convert from string to Byte[] using the following Java code:\nString source = \"0123456789\";\nbyte[] byteArray = source.getBytes(\"UTF-16\");\n\nWe get a byte array of length 22 bytes, we are not sure where this padding comes from.\nHow do I get an array of length 20?...
I'm new to the VxWorks environment, I'm wondering what C and C++ compilers are available for use with VxWorks?
VxWorks primarily supports the Wind River Tool Chain, which includes C and C++ compilers that are specifically designed for use with the VxWorks real-time operating system. The tool chain is typically based on GCC (GNU Compiler Collection) for C and C++. Here are the main compiler options available for VxWorks: 1. *...
27,136
[ { "from": "human", "value": "I'm new to the VxWorks environment, I'm wondering what C and C++ compilers are available for use with VxWorks?\n" }, { "from": "gpt", "value": "VxWorks primarily supports the Wind River Tool Chain, which includes C and C++ compilers that are specifically designed for...
Simple question really - how do I use text_field_with_auto_complete inside a form_for block? I've tried doing f.text_field_with_auto_complete but that gives an error, and just using text_field_with_auto_complete by itself doesn't seem to do anything. Am I missing something here?
In a Rails application, the method `text_field_with_auto_complete` is typically used to create a text field that integrates with an auto-complete feature. However, starting with Rails 3.1, this method has been deprecated in favor of using the jQuery UI's autocomplete functionality along with a regular text field. If y...
25,593
[ { "from": "human", "value": "Simple question really - how do I use text_field_with_auto_complete inside a form_for block?\nI've tried doing f.text_field_with_auto_complete but that gives an error, and just using text_field_with_auto_complete by itself doesn't seem to do anything.\nAm I missing something her...
I'm trying to write a small script to change the current directory to my project directory: #!/bin/bash cd /home/tree/projects/java I saved this file as proj, added execute permission with chmod, and copied it to /usr/bin. When I call it by: proj, it does nothing. What am I doing wrong?
The script you wrote changes the current directory to your project directory, but it won't work as expected because when you run a script, it executes in a subshell. This means that any changes to the current directory made by the script will not affect the current shell session that invoked the script. To solve this ...
26,749
[ { "from": "human", "value": "I'm trying to write a small script to change the current directory to my project directory:\n#!/bin/bash\ncd /home/tree/projects/java\n\nI saved this file as proj, added execute permission with chmod, and copied it to /usr/bin. When I call it by:\nproj, it does nothing. What am ...
SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not "borrow" the session cookie from the parent window. DETAILS: I'm working on an ASP.NET website (.NET 2.0). I use FormsAuthentication. It is a requirement to use cookies to handle the session. On a page I have a button. When the user ...
**Summary**: The issue arises when a popup window from an ASP.NET website opened in Windows Explorer does not share the session cookie with the parent window, resulting in a new session being created for the popup. This leads to a NullReferenceException when attempting to access session variables. **Details**: - The a...
20,457
[ { "from": "human", "value": "SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not \"borrow\" the session cookie from the parent window.\nDETAILS:\nI'm working on an ASP.NET website (.NET 2.0). I use FormsAuthentication. It is a requirement to use cookies to handle the sessi...
Hi I'm trying to debug a stored procedure through SQL Analyzer and one of the parameters is a timestamp datatype. If I wanted to pass 0x00000001410039E2 through as a parameter how would i do this? When I pass 0x00000001410039E2 I get a string truncation error and when I pass just 1410039E2 I get 0x1410039E20000000? Edi...
When dealing with a `timestamp` (or `rowversion`) data type in SQL Server, the value is usually specified in hexadecimal format. The timestamp in SQL Server is a unique binary value that can be represented in a hexadecimal format. In your case, the value you're trying to pass is `0x00000001410039E2`. If you're encount...
22,330
[ { "from": "human", "value": "Hi I'm trying to debug a stored procedure through SQL Analyzer and one of the parameters is a timestamp datatype. If I wanted to pass 0x00000001410039E2 through as a parameter how would i do this? When I pass 0x00000001410039E2 I get a string truncation error and when I pass jus...
I just added xUnit to our test project (for the Asserts, we're still using MSTest as the framework) and immediately the test runs refused to execute any of the tests. This is the error message: Failed to queue test run '{ .... }' Test run deployment issue: The location of the file or directory '...xUnit.dll' is ...
The error message you're encountering typically indicates that the test execution environment is not configured to trust the xUnit.dll file. This can happen if the test framework you are using (in your case MSTest) and the xUnit test assembly do not integrate well, or if there is a security restriction in the test exec...
24,266
[ { "from": "human", "value": "I just added xUnit to our test project (for the Asserts, we're still using MSTest as the framework) and immediately the test runs refused to execute any of the tests. This is the error message:\n\nFailed to queue test run '{ .... }'\n Test run deployment issue: The\n location ...
Are there any good examples (websites or books) around of how to build a full text search engine in F#?
Building a full-text search engine in F# can be an interesting project, and while there may not be extensive dedicated resources specifically focused on F#, you can find various materials that cover the necessary concepts and technologies you can apply using F#. Here are some resources that could help you: ### Website...
22,062
[ { "from": "human", "value": "Are there any good examples (websites or books) around of how to build a full text search engine in F#? \n" }, { "from": "gpt", "value": "Building a full-text search engine in F# can be an interesting project, and while there may not be extensive dedicated resources ...
In Visual Studio, two files are created when you create a new Windows Form in your solution (e.g. if you create MyForm.cs, MyForm.Designer.cs and MyForm.resx are also created). These second two files are displayed as a subtree in the Solution Explorer. Is there any way to add files to the sub-tree or group for a Window...
In Visual Studio, the sub-tree that you see in the Solution Explorer for a Windows Form (which includes the main form file, the designer file, and the resource file) is automatically generated by the IDE when you create a new Windows Form. Unfortunately, Visual Studio does not provide a direct way to manually group add...
22,286
[ { "from": "human", "value": "In Visual Studio, two files are created when you create a new Windows Form in your solution (e.g. if you create MyForm.cs, MyForm.Designer.cs and MyForm.resx are also created). These second two files are displayed as a subtree in the Solution Explorer.\nIs there any way to add f...
I have a MDB running in WebSphere, when it tries to pull a message off an MQ Queue the following exception is thrown: com.ibm.mq.MQException: Message catalog not found Any idea how to resolve this?
The error message you're encountering, "Message catalog not found," typically indicates that the IBM MQ client cannot locate the necessary message catalog files required to display error messages. This issue can arise for various reasons, such as missing files, incorrect environment settings, or configuration issues. ...
23,367
[ { "from": "human", "value": "I have a MDB running in WebSphere, when it tries to pull a message off an MQ Queue\nthe following exception is thrown:\ncom.ibm.mq.MQException: Message catalog not found \nAny idea how to resolve this?\n" }, { "from": "gpt", "value": "The error message you're enc...
On Windows XP, the following command in a script will prevent any power saving options from being enabled on the PC (monitor sleep, HD sleep, etc.). This is useful for kiosk applications. powercfg.exe /setactive presentation What is the equivalent on Vista?
On Windows Vista, you can achieve similar functionality by using the `powercfg` command in a script to set the power scheme to "Presentation." However, the command structure is slightly different. To prevent any power saving options from being enabled on Windows Vista, you can use the following command: ```bash power...
28,894
[ { "from": "human", "value": "On Windows XP, the following command in a script will prevent any power saving options from being enabled on the PC (monitor sleep, HD sleep, etc.). This is useful for kiosk applications.\npowercfg.exe /setactive presentation\n\nWhat is the equivalent on Vista?\n" }, { ...
When sending data over HTTPS, I know the content is encrypted, however I hear mixed answers about whether the headers are encrypted, or how much of the header is encrypted. How much of HTTPS headers are encrypted? Including GET/POST request URLs, Cookies, etc.
When you use HTTPS (HTTP over TLS/SSL), the transport layer encryption secures both the HTTP headers and the body of the request. Here's a breakdown of how this works: 1. **Encryption of Data in Transit**: HTTPS encrypts the entire HTTP message, which includes both the headers and the body. This means that any data se...
26,126
[ { "from": "human", "value": "When sending data over HTTPS, I know the content is encrypted, however I hear mixed answers about whether the headers are encrypted, or how much of the header is encrypted.\nHow much of HTTPS headers are encrypted?\nIncluding GET/POST request URLs, Cookies, etc.\n" }, { ...
There's loads of choices for .ico files but I can't see any logic in how Windows chooses which resolution/bit depth to show
In Windows, the selection of which .ico file to display is based on several factors, primarily influenced by the size and color depth of the icons available in the .ico file as well as the display settings of the system. Here are some key points about how Windows chooses which resolution and bit depth to display: 1. ...
24,627
[ { "from": "human", "value": "There's loads of choices for .ico files but I can't see any logic in how Windows chooses which resolution/bit depth to show\n" }, { "from": "gpt", "value": "In Windows, the selection of which .ico file to display is based on several factors, primarily influenced by t...
I am looking for the advantages of using RTSP to support streaming video to multiple devices. I have: Benefits of TCP. Commonly used protocol on web so supported by lots of infrastructure. Commonly used on web so lots of tools and stacks. Can use SSL. Wide device support (not sure on this one) Any other ideas?
Certainly! Here are additional advantages of using the Real-Time Streaming Protocol (RTSP) for streaming video to multiple devices: 1. **Low Latency Streaming**: RTSP is designed specifically for streaming media, enabling low-latency transmission. This is particularly beneficial for applications like live broadcasts a...
23,575
[ { "from": "human", "value": "I am looking for the advantages of using RTSP to support streaming video to multiple devices. I have:\n\nBenefits of TCP.\nCommonly used protocol on web so supported by lots of infrastructure.\nCommonly used on web so lots of tools and stacks.\nCan use SSL.\nWide device support...
In class, we learned about the halting problem, Turing machines, reductions, etc. A lot of classmates are saying these are all abstract and useless concepts, and there's no real point in knowing them (i.e., you can forget them once the course is over and not lose anything). Why is theory useful? Do you ever use it in y...
Theoretical concepts in computer science, such as the halting problem, Turing machines, and reductions, may seem abstract and unrelated to day-to-day coding at first glance, but they form the foundation of the discipline and have several practical implications. Here are some reasons why theory is useful: 1. **Understa...
24,586
[ { "from": "human", "value": "In class, we learned about the halting problem, Turing machines, reductions, etc. A lot of classmates are saying these are all abstract and useless concepts, and there's no real point in knowing them (i.e., you can forget them once the course is over and not lose anything).\nWhy...
What is the most efficient way to check if an array is a flat array of primitive values or if it is a multidimensional array? Is there any way to do this without actually looping through an array and running is_array() on each of its elements?
To determine if an array is a flat array of primitive values or a multidimensional array without explicitly looping through each element and checking with `is_array()`, you can use certain array functions or methods. However, most of these methods ultimately involve some level of iteration at the backend, but they can ...
25,314
[ { "from": "human", "value": "\nWhat is the most efficient way to check if an array is a flat array\nof primitive values or if it is a multidimensional array?\nIs there any way to do this without actually looping through an\narray and running is_array() on each of its elements?\n\n" }, { "from": "gpt...
What I'm trying to achieve is to determine if the Postscript that I'm parsing contains any element that resides in a table (box). Im asking whether if it had a built-in way to lay out tabular data on the page. My guess is that postscript doesnt have a concept of a table, cos I couldnt find it anywhere in the spec. The ...
You're correct that PostScript does not have a built-in concept of tables like you might find in higher-level document formats such as HTML or LaTeX. PostScript is a page description language primarily used for printing and does not have native support for complex structures like tables. Instead, you have to manually i...
24,171
[ { "from": "human", "value": "What I'm trying to achieve is to determine if the Postscript that I'm parsing contains any element that resides in a table (box).\nIm asking whether if it had a built-in way to lay out tabular data on the page. My guess is that postscript doesnt have a concept of a table, cos I ...
I've been using this long command: svn st | awk '/\?/ {print $2}' | xargs svn add Similarly, to svn rm files I accidentally deleted with normal rm with : svn st | awk '/\!/ {print $2}' | xargs svn rm --force I guess I can write a bash function to do these two, but I'd prefer an interactive add/rm like the one git has...
To create an interactive `svn` add and remove functionality similar to Git, you can create two Bash functions that will prompt you to select files to add or remove. Below is an example of how to define these functions in your `.bashrc` or `.bash_profile` file, so they're available in your terminal. ### Step 1: Define ...
22,058
[ { "from": "human", "value": "I've been using this long command:\nsvn st | awk '/\\?/ {print $2}' | xargs svn add\n\nSimilarly, to svn rm files I accidentally deleted with normal rm with :\nsvn st | awk '/\\!/ {print $2}' | xargs svn rm --force\n\nI guess I can write a bash function to do these two, but I'd ...
For example: javac Foo.java Note: Foo.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
The message you're seeing when compiling `Foo.java` indicates that there are potentially unsafe operations happening within your Java code, often related to generics. This warning is common when you use raw types, or when you cast to a generic type without proper checking, which can lead to `ClassCastException` at runt...
20,949
[ { "from": "human", "value": "For example:\njavac Foo.java\nNote: Foo.java uses unchecked or unsafe operations.\nNote: Recompile with -Xlint:unchecked for details.\n\n" }, { "from": "gpt", "value": "The message you're seeing when compiling `Foo.java` indicates that there are potentially unsafe op...
rsync -auve ssh --backup --suffix='2008-10-03-1514539' --backup-dir='/tmp/' module.pm root@web1:/path/to/module.pm I run this command without the --backup-dir option and when it copies the file over, it creates a backup with a current timestamp. When I include the --backup-dir option, it makes the backup into the /tmp...
The behavior you're observing with `rsync` when using both the `--backup` and `--backup-dir` options is indeed a bit confusing. Here's how it works: 1. **`--backup`**: This option instructs `rsync` to make a backup of the files that are being overwritten. By default, the backup filename will include a tilde (`~`) at t...
25,792
[ { "from": "human", "value": "rsync -auve ssh --backup --suffix='2008-10-03-1514539' --backup-dir='/tmp/' module.pm root@web1:/path/to/module.pm\n\nI run this command without the --backup-dir option and when it copies the file over, it creates a backup with a current timestamp. When I include the --backup-di...
I downloaded Squeak, the Image file, and the Sources file, but I can't figure out how to write Smalltalk code. Is there something obvious I'm missing? Is Squeak even the right IDE for serious Smalltalk development?
Squeak is indeed a powerful and popular environment for developing in Smalltalk, and it can definitely be used for serious development. However, it can be a bit overwhelming at first if you're not familiar with its interface and features. Here are some steps and tips to help you get started with writing Smalltalk code ...
18,549
[ { "from": "human", "value": "I downloaded Squeak, the Image file, and the Sources file, but I can't figure out how to write Smalltalk code. Is there something obvious I'm missing? Is Squeak even the right IDE for serious Smalltalk development?\n" }, { "from": "gpt", "value": "Squeak is indeed a ...
This sounds dumb, but I can't get it to work. I think i just dont' understand the difference between %%v, %v% and %v Here's what I'm trying to do: for %%v in (*.flv) do ffmpeg.exe -i "%%v" -y -f mjpeg -ss 0.001 -vframes 1 -an "%%v.jpg" This successfully generates a thumbnail for each of the movies, but the problem is:...
It looks like you're working with a batch script in Windows to create thumbnails from `.flv` files using `ffmpeg`. The syntax for manipulating strings in batch scripts can be a bit tricky at first. To achieve what you're trying to do—removing the last 4 characters (i.e., the `.flv` extension) from `%%v` and replacing ...
25,985
[ { "from": "human", "value": "This sounds dumb, but I can't get it to work. I think i just dont' understand the difference between %%v, %v% and %v\nHere's what I'm trying to do:\nfor %%v in (*.flv) do ffmpeg.exe -i \"%%v\" -y -f mjpeg -ss 0.001 -vframes 1 -an \"%%v.jpg\"\n\nThis successfully generates a thum...
Do they set display: none or visibility: hidden? I'm pretty sure display: none takes the element out of the normal flow, whilst visibility: hidden just hides the element but still has a reserved space for it. Should I just go download the unpacked version and study it or does someone have a quick answer?
You're correct in your understanding of the difference between `display: none;` and `visibility: hidden;`. - **`display: none;`**: This completely removes the element from the document layout. It does not occupy any space in the layout, which means the surrounding elements will act as if the element is not there at al...
27,278
[ { "from": "human", "value": "Do they set display: none or visibility: hidden?\nI'm pretty sure display: none takes the element out of the normal flow, whilst visibility: hidden just hides the element but still has a reserved space for it.\nShould I just go download the unpacked version and study it or does ...
Can Apache common vfs api retrieve/update/add files from/to the Mercurial version control system? Common vfs does have an interface api for accessing vcs. Is there a provider for Mercurial? hbagchi
Apache Commons VFS (Virtual File System) provides a unified API to interact with various file systems, including local, FTP, SFTP, and some version control systems (VCS). However, as of my last update, the Apache Commons VFS library does not natively support Mercurial (hg) as one of its built-in VCS providers. While A...
26,873
[ { "from": "human", "value": "Can Apache common vfs api retrieve/update/add files from/to the Mercurial version control system? Common vfs does have an interface api for accessing vcs. Is there a provider for Mercurial?\nhbagchi\n" }, { "from": "gpt", "value": "Apache Commons VFS (Virtual File Sy...
I have a WPF ListView which currently scrolls everytime I click on an item which is only partially visible. How can I keep the control from scrolling that item into view (instead simply selecting the partially visible one)? This behavior is very annoying when doing a drag from this control. Thanks. Added: I am lo...
To prevent the `ListView` from automatically scrolling to bring an item into view when it is partially visible, you can override the default behavior of the selection in your WPF `ListView`. This can be achieved by handling the `MouseDown` event of the `ListView` and preventing the automatic scrolling behavior. Here i...
21,276
[ { "from": "human", "value": "I have a WPF ListView which currently scrolls everytime I click on an item which is only partially visible. How can I keep the control from scrolling that item into view (instead simply selecting the partially visible one)? This behavior is very annoying when doing a drag from...
Why should I choose to use one instead of the other and in which cases? I mainly focus on desktop applications and personally speaking I do find the humble dialog box more easy and natural to use.
Choosing between different user interface elements, such as humble dialog boxes and other UI components, depends on several factors, including the context of use, user experience design principles, and the specific needs of your application. Below are some considerations that can help you decide when to use humble dial...
22,962
[ { "from": "human", "value": "Why should I choose to use one instead of the other and in which cases?\nI mainly focus on desktop applications and personally speaking I do find the humble dialog box more easy and natural to use.\n" }, { "from": "gpt", "value": "Choosing between different user inte...
So what is the easiest way to accomplish this?
To provide you with the best answer, I need more context about what you're trying to accomplish. Please specify the task or goal you have in mind, and I'll do my best to suggest the easiest way to achieve it!
30,089
[ { "from": "human", "value": "So what is the easiest way to accomplish this?\n" }, { "from": "gpt", "value": "To provide you with the best answer, I need more context about what you're trying to accomplish. Please specify the task or goal you have in mind, and I'll do my best to suggest the easie...
I would like to be able to "get information from the issue tracker" as described in the section "Getting Information from the Issue Tracker" at: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-bugtracker.html (display a dlg box to the user when they start a commit action in svn so they can choose form a li...
As of my last update in October 2023, TortoiseSVN itself does not come with a built-in COM plugin for issue tracking, and while it allows integration with external issue trackers, the specifics of those integrations can vary. However, there are a few steps you can take to see if there’s an existing solution or to simpl...
22,819
[ { "from": "human", "value": "I would like to be able to \"get information from the issue tracker\" as described in the section \"Getting Information from the Issue Tracker\" at: http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-bugtracker.html (display a dlg box to the user when they start a comm...
I am tring to get the ASDoc Ant task to work: <target name="asdoc" depends="compile"> <mkdir dir="${dist_asdocs}"/> <asdoc docSources="${srcdir}" output="${dist_asdocs}" executable="${FLEX_HOME}/bin/asdoc.exe" /> </target> When I run it I get errors from ASDoc like "Error: Type was not found or wa...
To resolve the issue you're experiencing with the ASDoc Ant task, you may need to ensure that the `source-path` parameter is included in your Ant task configuration. The ASDoc task requires access to the compiled sources so that it can generate documentation correctly. Here is how to adjust your Ant task: 1. **Compile...
25,460
[ { "from": "human", "value": "I am tring to get the ASDoc Ant task to work:\n<target name=\"asdoc\" depends=\"compile\">\n <mkdir dir=\"${dist_asdocs}\"/>\n <asdoc \n docSources=\"${srcdir}\"\n output=\"${dist_asdocs}\"\n executable=\"${FLEX_HOME}/bin/asdoc.exe\" />\n</target>\n\nWhen I run it...
What does "type-safe" mean?
"Type-safe" refers to a property of programming languages or systems that enforce strict rules about how data types can be used and interacted with. In a type-safe environment, operations on data are checked at compile time (or sometimes at runtime) to ensure that the data types being used are compatible with each othe...
27,615
[ { "from": "human", "value": "What does \"type-safe\" mean?\n" }, { "from": "gpt", "value": "\"Type-safe\" refers to a property of programming languages or systems that enforce strict rules about how data types can be used and interacted with. In a type-safe environment, operations on data are ch...
What's the most efficient way to select the last n number of rows in a table using mySQL? The table contains millions of rows, and at any given time I don't know how large the table is (it is constantly growing). The table does have a column that is automatically incremented and used as a unique identifier for each row...
To efficiently select the last `n` rows from a large MySQL table with millions of rows, where you have an auto-incrementing unique identifier (let's assume this column is named `id`), you can use a combination of the `ORDER BY` clause and the `LIMIT` clause. Here's a query that selects the last `n` rows based on the a...
24,306
[ { "from": "human", "value": "What's the most efficient way to select the last n number of rows in a table using mySQL? The table contains millions of rows, and at any given time I don't know how large the table is (it is constantly growing). The table does have a column that is automatically incremented and...
I have a bunch of XML that has lines that look like this <_char font_name="/ITC Stone Serif Std Bold" italic="true" /> but sometimes look like this <_char font_size="88175" italic="true" font_name="/ITC Stone Serif Std Bold" /> Here's what I need to do Replace italic="true" with italic="false for every line that con...
You can achieve this with a single regex using a capturing group to identify the `italic` attribute and a conditional replacement. Here's the regex pattern you can use: ### Regex Pattern ``` (_char(?=[^>]*font_name="[^"]*\/ITC Stone Serif Std Bold[^"]*")[^>]*?)italic="true"([^>]*?>) ``` ### Replacement String ``` $1i...
20,639
[ { "from": "human", "value": "I have a bunch of XML that has lines that look like this\n<_char font_name=\"/ITC Stone Serif Std Bold\" italic=\"true\" />\n\nbut sometimes look like this\n<_char font_size=\"88175\" italic=\"true\" font_name=\"/ITC Stone Serif Std Bold\" />\n\nHere's what I need to do\n\nRepla...
I have to connect to a legacy postgres database which has ENCODING = 'SQL_ASCII';. How do I set this encoding in my rails app?
In a Rails application, you can specify the database encoding in your database configuration file, typically located at `config/database.yml`. If your legacy PostgreSQL database uses `SQL_ASCII` encoding, you should set the encoding option in your configuration. Here's how you can set it: 1. Open your `config/databas...
26,517
[ { "from": "human", "value": "I have to connect to a legacy postgres database which has ENCODING = 'SQL_ASCII';.\nHow do I set this encoding in my rails app?\n" }, { "from": "gpt", "value": "In a Rails application, you can specify the database encoding in your database configuration file, typical...
we had a heated discussion about a method name. We have a class User. There is property called "Groups" on the user. It contains all groups that contain the user directly. That's ok. What we have problem with, is the name of the method that would recursively list all user's groups and their "parent" groups and return ...
Choosing a clear and descriptive method name is important for code readability and maintainability. Here are some suggestions that convey the purpose of the method while keeping it concise: 1. **GetAllMemberGroups** - This implies that the method retrieves all groups that the user is a member of, including parent grou...
25,418
[ { "from": "human", "value": "we had a heated discussion about a method name. \nWe have a class User. There is property called \"Groups\" on the user. It contains all groups that contain the user directly. That's ok. What we have problem with, is the name of the method that would recursively list all user's ...
Hi I'd like to schedule an existing job in the Sql Server 2005 agent via C# code... i.e. when someone clicks a button on an asp.net web page. How can I do this? Thanks!
To schedule an existing SQL Server Agent job programmatically in SQL Server 2005 using C#, you can execute a SQL command to start the job when a button is clicked on an ASP.NET webpage. You need to have proper permissions to access the SQL Server and execute jobs. Here’s a step-by-step guide on how to do this: 1. **S...
23,818
[ { "from": "human", "value": "Hi I'd like to schedule an existing job in the Sql Server 2005 agent via C# code... i.e. when someone clicks a button on an asp.net web page.\nHow can I do this?\nThanks!\n" }, { "from": "gpt", "value": "To schedule an existing SQL Server Agent job programmatically i...
SNTP is a simplification of the full NTP specification. I'd like to use a full NTP client against the internal SNTP server incorporated in Windows XP. Will that work or is a full NTP server required for the NTP client to work?
Yes, you can use a full NTP client against the internal SNTP server in Windows XP. The SNTP implementation in Windows XP is compatible with the NTP protocol, meaning that NTP clients should be able to synchronize time with the Windows XP SNTP server. However, keep in mind that while an NTP client can communicate with ...
28,244
[ { "from": "human", "value": "SNTP is a simplification of the full NTP specification.\nI'd like to use a full NTP client against the internal SNTP server incorporated in Windows XP. Will that work or is a full NTP server required for the NTP client to work?\n" }, { "from": "gpt", "value": "Yes, y...
Is it possible to open an HTML page using navigateToURL and specifying a named frame in your HTML document? For instance, if you have an iframe on the page called "Steven", can you call navigateToURL("someURL","Steven"); instead of something like navigateToURL("someURL","_self"); I have tried this and it opens the UR...
In ActionScript (especially ActionScript 2.0), when you want to navigate a specific frame or iframe in an HTML document using the `navigateToURL` function, you need to ensure that you're specifying the target frame correctly. However, the `navigateToURL` function does not directly allow you to specify a frame by its n...
25,209
[ { "from": "human", "value": "Is it possible to open an HTML page using navigateToURL and specifying a named frame in your HTML document? For instance, if you have an iframe on the page called \"Steven\", can you call\nnavigateToURL(\"someURL\",\"Steven\");\n\ninstead of something like\nnavigateToURL(\"someU...
I've opened the cmd in windows and I've created a directory by using md command. After that I've opened a text file via notepad <name>, wrote my program and gave .c extention while saving the file. How can I compile and run my C program to get an output? I've also other programs in my directory: how can I create .exe f...
To compile and run your C program in Windows after you have created your directory and written your C code, follow these steps: ### Step 1: Install a C Compiler Before you can compile C programs, you need to have a C compiler installed on your system. A popular choice is **MinGW** (Minimalist GNU for Windows), which p...
22,686
[ { "from": "human", "value": "I've opened the cmd in windows and I've created a directory by using md command. After that I've opened a text file via notepad <name>, wrote my program and gave .c extention while saving the file.\nHow can I compile and run my C program to get an output? I've also other program...
What is the best solution to sanitize output HTML in Rails (to avoid XSS attacks)? I have two options: white_list plugin or sanitize method from Sanitize Helper http://api.rubyonrails.com/classes/ActionView/Helpers/SanitizeHelper.html . For me until today the white_list plugin worked better and in the past, Sanitize wa...
In Rails, sanitizing output HTML is crucial to prevent XSS (Cross-Site Scripting) attacks. Between the options you mentioned — the `white_list` plugin and the `sanitize` method from the `SanitizeHelper` — it's generally recommended to use the built-in `sanitize` method. ### Why Use the `sanitize` Method? 1. **Built-i...
23,482
[ { "from": "human", "value": "What is the best solution to sanitize output HTML in Rails (to avoid XSS attacks)?\nI have two options: white_list plugin or sanitize method from Sanitize Helper http://api.rubyonrails.com/classes/ActionView/Helpers/SanitizeHelper.html . For me until today the white_list plugin ...
I want to be able to use a function such as writefln() but without having to add import std.stdio at the top of the file. Another way to explain it is the way you do it in C++. You can type std::cout << "Test"; and that will stop you from having to add using namespace std;. I want to do the same thing, but in D.
In D, you can achieve similar functionality to C++'s `std::cout` by qualifying the functions or types with their module names. However, if you want to use `writefln()` without importing `std.stdio` at the top of the file, you can create a small helper module or use a combination of techniques to make it easier. ### Me...
26,190
[ { "from": "human", "value": "I want to be able to use a function such as writefln() but without having to add import std.stdio at the top of the file.\nAnother way to explain it is the way you do it in C++. You can type std::cout << \"Test\"; and that will stop you from having to add using namespace std;. I...
I tried this step: Select the menu options "Project > New Build Phase > New Run Script Build Phase", and enter the following script (don't forget to replace /Users/youruser/bin by the correct path to gen_entitlements.py) : export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_alloca...
To remove the "Run Script Build Phase" from your project in Xcode, you can follow these steps: 1. **Open your project in Xcode.** 2. **Select your project in the Project Navigator** (the left sidebar). 3. **Select the target** from the list of targets in the main pane (the middle pane). 4. **Navigate to the "Build Pha...
26,632
[ { "from": "human", "value": "I tried this step:\nSelect the menu options \"Project > New Build Phase > New Run Script Build Phase\", and enter the following script (don't forget to replace /Users/youruser/bin by the correct path to gen_entitlements.py) :\nexport CODESIGN_ALLOCATE=/Developer/Platforms/iPhone...
const static int foo = 42; I saw this in some code here on StackOverflow and I couldn't figure out what it does. Then I saw some confused answers on other forums. My best guess is that it's used in C to hide the constant foo from other modules. Is this correct? If so, why would anyone use it in a C++ context where you...
Yes, your understanding is correct! The declaration `const static int foo = 42;` is used in C and C++ to limit the scope and linkage of the constant variable `foo`. ### Explanation of `const static` 1. **`const`**: This keyword indicates that the value of `foo` cannot be changed after it is initialized. The compiler ...
25,837
[ { "from": "human", "value": "const static int foo = 42;\n\nI saw this in some code here on StackOverflow and I couldn't figure out what it does. Then I saw some confused answers on other forums. My best guess is that it's used in C to hide the constant foo from other modules. Is this correct? If so, why wou...
I am using a popup menu in Delphi. I want to use it in a "radio group" fashion where if the user selects an item it is checked and the other items are not checked. I tried using the AutoCheck property, but this allows multiple items to be checked. Is there a way to set the popup menu so that only one item can be che...
In Delphi, the standard `TPopupMenu` does not directly support the radio button behavior you're looking for using the `AutoCheck` property alone. However, you can achieve this behavior by handling the `OnClick` event for the menu items yourself. Here’s how you can implement a radio group behavior in a `TPopupMenu`: ...
17,283
[ { "from": "human", "value": "I am using a popup menu in Delphi. I want to use it in a \"radio group\" fashion where if the user selects an item it is checked and the other items are not checked. I tried using the AutoCheck property, but this allows multiple items to be checked. Is there a way to set the ...
Is there a way to produce a diagram showing existing tables and their relationships given a connection to a database? This is for SQL Server 2008 Express Edition.
Yes, you can generate a diagram showing existing tables and their relationships in SQL Server 2008 Express Edition using SQL Server Management Studio (SSMS). Although SQL Server Express does not support the full set of features available in higher editions of SQL Server, it does allow you to create and view database di...
23,897
[ { "from": "human", "value": "Is there a way to produce a diagram showing existing tables and their relationships given a connection to a database?\nThis is for SQL Server 2008 Express Edition.\n" }, { "from": "gpt", "value": "Yes, you can generate a diagram showing existing tables and their rela...
I am trying to access Outlook 2007 from C#. I have installed the PIA msi after following the directions found on msdn. After a successful install nothing shows up in Visual Studio's references under the .net tab.
If you've successfully installed the Primary Interop Assemblies (PIAs) for Outlook 2007 but can't see them in Visual Studio's .NET tab, you may need to add the references manually. Here's how you can do that: ### Step-by-Step Instructions to Add Outlook 2007 Reference in Visual Studio: 1. **Open your Project**: Launc...
21,654
[ { "from": "human", "value": "I am trying to access Outlook 2007 from C#. I have installed the PIA msi after following the directions found on msdn. After a successful install nothing shows up in Visual Studio's references under the .net tab.\n" }, { "from": "gpt", "value": "If you've successfu...
What are some of the lesser know, but important and useful features of Windows batch files? Guidelines: One feature per answer Give both a short description of the feature and an example, not just a link to documentation Limit answers to native funtionality, i.e., does not require additional software, like the Windows...
### Delayed Variable Expansion **Description:** Delayed variable expansion allows you to use the value of a variable at execution time rather than at parse time. This is particularly useful in loops and conditional statements where the value of a variable may change during execution. **Example:** In this example,...
26,849
[ { "from": "human", "value": "What are some of the lesser know, but important and useful features of Windows batch files?\nGuidelines:\n\nOne feature per answer\nGive both a short description of the feature and an example, not just a link to documentation\nLimit answers to native funtionality, i.e., does not...
I understand that requests are served by different threads, but do they all come from the same appdomain, too?
In the context of ASP.NET applications, requests are typically served within the same AppDomain. An AppDomain provides an isolation boundary for applications, allowing them to run in a controlled environment. When a web application runs in an ASP.NET environment, it is hosted within a single AppDomain, which allows mul...
26,138
[ { "from": "human", "value": "I understand that requests are served by different threads, but do they all come from the same appdomain, too?\n" }, { "from": "gpt", "value": "In the context of ASP.NET applications, requests are typically served within the same AppDomain. An AppDomain provides an i...
I have a bunch of tables using user-defined data type for PK column. Is it possible to change this type Using SQL Server 2005?
Yes, it is possible to change the data type of a primary key (PK) column that is defined using a user-defined data type in SQL Server 2005, but it requires a few steps because you cannot directly alter the data type of a primary key column. Here’s a general outline of the steps you would need to take: ### Steps to Cha...
24,008
[ { "from": "human", "value": "I have a bunch of tables using user-defined data type for PK column. Is it possible to change this type Using SQL Server 2005?\n" }, { "from": "gpt", "value": "Yes, it is possible to change the data type of a primary key (PK) column that is defined using a user-defin...
How do I link an external .jar into my Xcode java project? That is, have it in the classpath during compilation and execution. I'm using Xcode 3.0 and this seems to have changed since 2.4.
Linking an external `.jar` file in an Xcode Java project has changed between versions. Since you're using Xcode 3.0, you can follow these steps to include your `.jar` file in the classpath for both compilation and execution: 1. **Add the .jar File to Your Project**: - First, make sure your `.jar` file is part of yo...
25,899
[ { "from": "human", "value": "How do I link an external .jar into my Xcode java project? That is, have it in the classpath during compilation and execution. I'm using Xcode 3.0 and this seems to have changed since 2.4.\n" }, { "from": "gpt", "value": "Linking an external `.jar` file in an Xcode...
I want to be able to put preformatted text (i.e. containing line breaks) into a single cell of a FitNesse fixture table. Is there a way to manipulate the FitNesse wiki markup to do this?
In FitNesse, if you want to include preformatted text with line breaks in a single cell of a fixture table, you can use the double braces `{{ ... }}` syntax to enclose your text. This syntax allows you to include line breaks and special characters without breaking the table format. Here’s how you can format your text:...
27,586
[ { "from": "human", "value": "I want to be able to put preformatted text (i.e. containing line breaks) into a single cell of a FitNesse fixture table. Is there a way to manipulate the FitNesse wiki markup to do this?\n" }, { "from": "gpt", "value": "In FitNesse, if you want to include preformatte...
I got a problem like this (this is html/css menu): Eshop | Another eshop | Another eshop Client wants it work like this: User comes to website, clicks on Eshop. Eshop changes to red color with red box outline. User decides to visit Another eshop, so Eshop will go back to normaln color without red box outline, and anoth...
To achieve the behavior you're describing for the menu, you can use JavaScript to manage the state of the active menu item. Below is a simple implementation using HTML, CSS, and JavaScript. ### HTML ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=devi...
19,951
[ { "from": "human", "value": "I got a problem like this (this is html/css menu):\nEshop | Another eshop | Another eshop\nClient wants it work like this:\nUser comes to website, clicks on Eshop. Eshop changes to red color with red box outline. User decides to visit Another eshop, so Eshop will go back to norm...
Just because I'm curious--is there any C analog to the functionality of the STL in C++? I've seen mention of a GTK+ library called glib that a few people consider fills the bill but are there other libraries that would provide STL functionality in C?
In C++, the Standard Template Library (STL) provides a rich set of template classes and algorithms for managing collections of data, such as vectors, lists, and maps, along with algorithms for manipulating them. In C, there is no direct equivalent to the STL due to the lack of templates and the different programming pa...
25,103
[ { "from": "human", "value": "Just because I'm curious--is there any C analog to the functionality of the STL in C++? I've seen mention of a GTK+ library called glib that a few people consider fills the bill but are there other libraries that would provide STL functionality in C?\n" }, { "from": "gp...
Is there a built-in way to sort a CArray in C++?
In C++, the `CArray` class itself does not exist as a standard part of the language or its standard library. However, if you're referring to a custom array-like structure or a C-style array, you can use the `std::sort` algorithm provided by the C++ Standard Library to sort an array. Here’s how you can sort an array us...
25,369
[ { "from": "human", "value": "Is there a built-in way to sort a CArray in C++?\n" }, { "from": "gpt", "value": "In C++, the `CArray` class itself does not exist as a standard part of the language or its standard library. However, if you're referring to a custom array-like structure or a C-style a...
How can I count the number of elements in an array, because contrary to logic array.count(string) does not count all the elements in the array, it just searches for the number of occurrences of string.
In Python, if you want to count the total number of elements in an array (or list), you can use the built-in `len()` function. This function returns the number of elements in the list, regardless of their values. Here's how you can do it: ```python my_array = [1, 2, 3, 4, 5] count = len(my_array) print(count) # Outpu...
24,474
[ { "from": "human", "value": "How can I count the number of elements in an array, because contrary to logic array.count(string) does not count all the elements in the array, it just searches for the number of occurrences of string.\n" }, { "from": "gpt", "value": "In Python, if you want to count ...
I would like to use Pylons with Elixir, however, I am not sure what is the best way to get about doing this. There are several blog posts (cleverdevil, beachcoder, adam hoscilo) and even an entire new framework about how to go about doing this; however, I am not certain about the differences between them. Which one is ...
Pylons is a Python web framework, while Elixir is a language used for building concurrent and distributed systems, primarily for the Erlang virtual machine (BEAM). It seems there may be some confusion regarding the use of Pylons with Elixir, as they serve different purposes and are used in different programming environ...
23,792
[ { "from": "human", "value": "I would like to use Pylons with Elixir, however, I am not sure what is the best way to get about doing this. There are several blog posts (cleverdevil, beachcoder, adam hoscilo) and even an entire new framework about how to go about doing this; however, I am not certain about th...
I kind of wish that there were a version of re.findall that returned groupdicts instead of just groups. Am I missing some simple way to accomplish the same result? Does anybody know of a reason that this function doesn't exist?
You're correct that Python's `re.findall` returns a list of tuples with the matched groups, but it doesn't provide a built-in way to return a list of dictionaries where the keys are the named groups. However, you can achieve similar functionality using a combination of `re.finditer` and a list comprehension. Here's ho...
26,727
[ { "from": "human", "value": "I kind of wish that there were a version of re.findall that returned groupdicts instead of just groups. Am I missing some simple way to accomplish the same result?\nDoes anybody know of a reason that this function doesn't exist?\n" }, { "from": "gpt", "value": "You'r...
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move a file with Jython? and while we at it, how does one delete a file with Jython?
In Jython, which is an implementation of Python that runs on the Java platform, you may not have access to the same libraries as standard Python, including `shutil`. However, you can still perform file operations using the Java `java.nio.file` package and other Java IO classes. ### Moving a File with Jython To move a...
26,359
[ { "from": "human", "value": "'''use Jython'''\n\nimport shutil\n\nprint dir(shutil)\n\nThere is no, shutil.move, how does one move a file with Jython?\nand while we at it, how does one delete a file with Jython?\n" }, { "from": "gpt", "value": "In Jython, which is an implementation of Python tha...
I need to write an extension method on a byte[]. Is that possible?
Yes, you can create an extension method for a `byte[]` array in C#. Extension methods allow you to "add" methods to existing types without modifying them. Below is an example of how to create an extension method for a `byte[]` array. ### Example: Creating an Extension Method for `byte[]` Here’s an example where we cr...
26,027
[ { "from": "human", "value": "I need to write an extension method on a byte[]. Is that possible?\n" }, { "from": "gpt", "value": "Yes, you can create an extension method for a `byte[]` array in C#. Extension methods allow you to \"add\" methods to existing types without modifying them. Below is ...
What Abstract Datatypes should be added to OpenJDK7 ?
OpenJDK 7, which was released in July 2011, already includes a robust set of data structures and abstractions. However, considering advancements in software design and requirements since then, here are some abstract data types that could be beneficial if added to a hypothetical future version of OpenJDK: 1. **Immutabl...
21,268
[ { "from": "human", "value": "What Abstract Datatypes should be added to OpenJDK7 ?\n" }, { "from": "gpt", "value": "OpenJDK 7, which was released in July 2011, already includes a robust set of data structures and abstractions. However, considering advancements in software design and requirements...
Can dynamic variables in C# 4.0 be members on a class or passed into or returned from methods? var from C# 3.0 couldn't but I haven't seen any mention anywhere of whether it is possible or not with dynamic.
Yes, in C# 4.0, `dynamic` variables can indeed be members of a class, as well as be passed into or returned from methods. This is one of the key differences between `dynamic` and `var`. While `var` is a statically-typed keyword that infers the type at compile time and must be initialized at declaration, `dynamic` is a ...
25,643
[ { "from": "human", "value": "Can dynamic variables in C# 4.0 be members on a class or passed into or returned from methods? var from C# 3.0 couldn't but I haven't seen any mention anywhere of whether it is possible or not with dynamic.\n" }, { "from": "gpt", "value": "Yes, in C# 4.0, `dynamic` v...
A colleague would like to query a table in an Oracle database using SQL Server 2000, Enterprise Manager. He knows how to do the whole DTS thing, but doesn't want to go down that route for add hoc queries. Is there another way?
Yes, there are a few methods your colleague can use to query an Oracle database from SQL Server 2000 without relying on DTS (Data Transformation Services). Here are some alternatives: 1. **Linked Servers**: SQL Server supports the concept of linked servers, allowing you to connect to other databases including Oracl...
25,233
[ { "from": "human", "value": "A colleague would like to query a table in an Oracle database using SQL Server 2000, Enterprise Manager.\nHe knows how to do the whole DTS thing, but doesn't want to go down that route for add hoc queries.\nIs there another way?\n" }, { "from": "gpt", "value": "Yes, ...
I'm building a website for a small non-profit org. and I was wondering at what kind of browser marketshare a browser should have before I support it. Chrome looks like a major contender, but it's still less than 5%, as is Opera. What browsers do you think I should completely support for this kind of project?
When building a website for a small non-profit organization, it's important to ensure a good user experience across the most widely used browsers. As of my last update, here are some general guidelines for browser market share and support: 1. **Chrome**: Chrome is the most widely used browser, often accounting for aro...
25,134
[ { "from": "human", "value": "I'm building a website for a small non-profit org. and I was wondering at what kind of browser marketshare a browser should have before I support it. Chrome looks like a major contender, but it's still less than 5%, as is Opera. \nWhat browsers do you think I should completely s...
can you please tell me which add-in you are using to generate real/integer values in Excel 2007 (running on Vista SP1)? I have tried a couple of them and particularly Random Generator from AbleBits.com but there are some problems with entering lowest and highest values there. I guess this is due to Office 2007 & Vista...
In Excel 2007, you can generate random integer values without the need for an add-in by using built-in functions. You can use the `RANDBETWEEN` function to generate random integers within a specified range. Here's how to use it: 1. Click on a cell where you want the random integer to appear. 2. Enter the following fo...
26,964
[ { "from": "human", "value": "can you please tell me which add-in you are using to generate real/integer values in Excel 2007 (running on Vista SP1)? I have tried a couple of them and particularly Random Generator from AbleBits.com but there are some problems with entering lowest and highest values there. I...
How can I package tagfiles in a jar so it can be reused across multiple projects?
To package tag files (or any resource files) in a JAR file for reuse across multiple projects, you can follow these general steps: ### 1. Organize Your Files First, organize your tag files into a directory structure that makes sense for your project. For example: ``` my-tagfiles/ │ ├── META-INF/ │ └── MANIFEST.MF ...
22,631
[ { "from": "human", "value": "How can I package tagfiles in a jar so it can be reused across multiple projects?\n" }, { "from": "gpt", "value": "To package tag files (or any resource files) in a JAR file for reuse across multiple projects, you can follow these general steps:\n\n### 1. Organize Yo...
I have a UITableView set up as a navigation controller type deal (like the default in Xcode). I have added an "Add" button which adds an element to the UITableView. When I call -selectRowAtIndexPath: on this new row I just added, it will highlight the row, but the next view is not pushed onto the stack. I assume this i...
Yes, you are correct that calling `selectRowAtIndexPath:` will highlight the row but will not trigger the `tableView:didSelectRowAtIndexPath:` delegate method, which is typically used to handle the selection and push the next view controller. To programmatically push a new view controller onto the navigation stack aft...
25,057
[ { "from": "human", "value": "I have a UITableView set up as a navigation controller type deal (like the default in Xcode). I have added an \"Add\" button which adds an element to the UITableView. When I call -selectRowAtIndexPath: on this new row I just added, it will highlight the row, but the next view is...
I've been curious in the past few months in trying my hand at doing some assembly for the SPARC processor (either V8 or V9). My question is this, I have no access to a SPARC machine, is there a way I can run SPARC binaries on my x86 machine? I've looked at QEMU but I am not too sure how to set it up.
Running SPARC binaries on an x86 machine can indeed be achieved using QEMU, which is a versatile emulator capable of running multiple architectures, including SPARC. Here’s a step-by-step guide to get you started: ### Step 1: Install QEMU First, you need to install QEMU on your x86 machine. Depending on your operatin...
20,706
[ { "from": "human", "value": "I've been curious in the past few months in trying my hand at doing some assembly for the SPARC processor (either V8 or V9). My question is this, I have no access to a SPARC machine, is there a way I can run SPARC binaries on my x86 machine? I've looked at QEMU but I am not too ...
I have just installed Eclipse 3.4 and found out that there is not a plugin to create Swing applications yet. I also have found that there is a Matisse implementation in MyEclipse IDE, but I'd like to now whether there is such a Matisse plugin for free.
As of Eclipse 3.4, there wasn't an official Matisse plugin available for free. Matisse is a GUI builder that was initially developed for Sun's NetBeans IDE. However, there are a couple of alternatives you can consider for creating Swing applications in Eclipse: 1. **WindowBuilder**: This is a popular free plugin for E...
27,574
[ { "from": "human", "value": "I have just installed Eclipse 3.4 and found out that there is not a plugin to create Swing applications yet. I also have found that there is a Matisse implementation in MyEclipse IDE, but I'd like to now whether there is such a Matisse plugin for free.\n" }, { "from": "g...
Essentially my question is, does anyone know of a utility for inspecting the buffer cache in linux?
Yes, there are several utilities and tools you can use to inspect the buffer cache in Linux. Here are some of the most commonly used ones: 1. **`free` Command**: The `free` command provides a quick overview of the system's memory usage, including buffer and cache sizes. You can use it like this: ```bash free -m ...
23,227
[ { "from": "human", "value": "Essentially my question is, does anyone know of a utility for inspecting the buffer cache in linux?\n" }, { "from": "gpt", "value": "Yes, there are several utilities and tools you can use to inspect the buffer cache in Linux. Here are some of the most commonly used o...
Can't seem to rename an existing Verity collection in ColdFusion without deleting, recreating, and rebuilding the collection. Problem is, I have some very large collections I'd rather not have to delete and rebuild from scratch. Any one have a handy trick for this conundrum?
In ColdFusion, the Verity collections do not support direct renaming once they have been created. As you've discovered, the only way to change a collection's name is to delete and recreate it, which is not ideal for large collections due to the overhead of rebuilding the index. However, you can use a workaround that i...
21,810
[ { "from": "human", "value": "Can't seem to rename an existing Verity collection in ColdFusion without deleting, recreating, and rebuilding the collection. Problem is, I have some very large collections I'd rather not have to delete and rebuild from scratch. Any one have a handy trick for this conundrum?\n...
What is the simplest way to programmatically export Excel data to Matlab?
Exporting Excel data to MATLAB can be accomplished easily using MATLAB's built-in functions. Here are some straightforward methods to do so, depending on your needs and the format of your Excel data. ### Method 1: Using `readtable` This method is suitable for reading data from Excel into a MATLAB table, which is very...
22,331
[ { "from": "human", "value": "What is the simplest way to programmatically export Excel data to Matlab?\n" }, { "from": "gpt", "value": "Exporting Excel data to MATLAB can be accomplished easily using MATLAB's built-in functions. Here are some straightforward methods to do so, depending on your n...
I'm looking for a way to visualize a piece of GML I'm receiving. What is the best freely available java library to use for this task?
For visualizing GML (Geography Markup Language) in Java, a popular and freely available library you can use is **GeoTools**. GeoTools is an open-source Java library that provides tools for geospatial data and includes support for GML among many other formats. ### Key Features of GeoTools: - **Support for GML**: GeoToo...
19,024
[ { "from": "human", "value": "I'm looking for a way to visualize a piece of GML I'm receiving. What is the best freely available java library to use for this task?\n" }, { "from": "gpt", "value": "For visualizing GML (Geography Markup Language) in Java, a popular and freely available library you ...
Consider the following code: void Handler(object o, EventArgs e) { // I swear o is a string string s = (string)o; // 1 //-OR- string s = o as string; // 2 // -OR- string s = o.ToString(); // 3 } What is the difference between the three types of casting (okay, the 3rd one is not a casting, but you get...
In the provided code snippet, you have three different ways to convert an `object` to a `string`. Here's a breakdown of each approach: ### 1. Explicit Casting ```csharp string s = (string)o; // 1 ``` - This method attempts to cast `o` directly to a `string`. If `o` is not actually a `string`, this will throw an `Inval...
22,432
[ { "from": "human", "value": "Consider the following code:\nvoid Handler(object o, EventArgs e)\n{\n // I swear o is a string\n string s = (string)o; // 1\n //-OR-\n string s = o as string; // 2\n // -OR-\n string s = o.ToString(); // 3\n}\n\nWhat is the difference between the three types of cast...