instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am a beginner of python and have a question, very confusing for me. If I define a function first but within the function I have to use a variable which is defined in another function below, can I do it like this? Or how can I import the return things of another function into a function? for example: def hello(x,y): ...
In Python, the order in which you define your functions matters. If you want to use a function within another function, the function you are calling must be defined before the function that calls it. In your case, you are trying to use the `hi` function within the `hello` function, but `hi` is defined afterward. This...
45,363
[ { "from": "human", "value": "I am a beginner of python and have a question, very confusing for me.\nIf I define a function first but within the function I have to use a variable which is defined in another function below, can I do it like this? Or how can I import the return things of another function into ...
Do I need a separate controller for the below? http://localhost/bookmarks --> bookmarks controller http://localhost/bookmark/{bookmarkid} --> bookmark controller Is there any way I can combine them both into one controller? I want to keep the uri's the same i.e. bookmark singular indicating fetch a single bookmark. Th...
Yes, you can combine both endpoints into a single controller while keeping the desired URIs. This is commonly done in web frameworks like Laravel, Express, or Ruby on Rails. The idea is to have one controller handle both the collection of bookmarks and the individual bookmark retrieval. Here’s how you can achieve this...
44,742
[ { "from": "human", "value": "Do I need a separate controller for the below?\nhttp://localhost/bookmarks --> bookmarks controller\nhttp://localhost/bookmark/{bookmarkid} --> bookmark controller\nIs there any way I can combine them both into one controller? I want to keep the uri's the same i.e. bookmark sin...
Does anyone know any source of examples and templates for software requirements, build environment description and other kind of documentations that are common for software development? Thanks!
Yes, there are several resources where you can find examples and templates for software requirements, build environment descriptions, and other common software development documentation. Here are some sources you might find helpful: ### 1. **IEEE Standards** - **IEEE 830**: Standard for Software Requirements Specif...
45,749
[ { "from": "human", "value": "Does anyone know any source of examples and templates for software requirements, build environment description and other kind of documentations that are common for software development?\nThanks!\n" }, { "from": "gpt", "value": "Yes, there are several resources where ...
So I have been using Leopard for a year now, and the lastest update broke the keyboard mapping for eclipse. I use the dvorak layout, and now in eclipse if I press the ⌘ and the b key it does a build, instead of a cut(b = x). Does anyone else have this issue, and are there any workarounds? EDIT: The best current worka...
It sounds like you're experiencing a keyboard mapping issue with Eclipse after a recent update. This can sometimes happen due to changes in the operating system or application settings that affect how keyboard shortcuts are interpreted. Since you mentioned that upgrading to 10.5.7 is a workaround, here are a few addit...
48,888
[ { "from": "human", "value": "So I have been using Leopard for a year now, and the lastest update broke the keyboard mapping for eclipse. I use the dvorak layout, and now in eclipse if I press the ⌘ and the b key it does a build, instead of a cut(b = x).\nDoes anyone else have this issue, and are there any ...
How do I extract a double value from a string using regex. import re pattr = re.compile(???) x = pattr.match("4.5")
To extract a double (floating-point) value from a string using regular expressions in Python, you can use the `re` module along with a suitable regex pattern. Here's a regex pattern that matches floating-point numbers, including integers and decimals: ```python import re # Regex pattern for matching floating-point nu...
48,118
[ { "from": "human", "value": "How do I extract a double value from a string using regex.\nimport re\n\npattr = re.compile(???) \nx = pattr.match(\"4.5\") \n\n" }, { "from": "gpt", "value": "To extract a double (floating-point) value from a string using regular expressions in Python, you c...
I'd hate to have to relearn C++ just for this! Any libraries/URLs would be great and yes, Google didn't help much here :-( This is for an upcoming project in which my product (Java based) would provide support for Microsoft's Hyper-V virtualization platform. Unlike VMware, which provides a Web-service, the Hyper-V API...
Integrating Java with Microsoft's Hyper-V using WMI can indeed be a challenge due to the lack of robust Java libraries for WMI. Since you're looking to use C and JNI rather than C++, here are some suggestions to help you get started. ### Libraries and Resources for WMI in C: 1. **WMI COM Interfaces**: WMI is acces...
39,897
[ { "from": "human", "value": "I'd hate to have to relearn C++ just for this! Any libraries/URLs would be great and yes, Google didn't help much here :-( \nThis is for an upcoming project in which my product (Java based) would provide support for Microsoft's Hyper-V virtualization platform. Unlike VMware, whi...
Below is my table, a User could have multiple profiles in certain languages, non-English profiles have a higher priority. +----------+--------+----------------+----------------+ |ProfileID |UserID |ProfileLanguage |ProfilePriority | +----------+--------+----------------+----------------+ |1 |1 |en-US ...
To retrieve the complete records with `ProfileID`, `UserID`, `ProfileLanguage`, and `ProfilePriority` for the specified conditions, you can use a subquery to first select the relevant `UserID`s along with the minimum `ProfilePriority`, and then join that result back with the original table. Here’s how you can structur...
48,440
[ { "from": "human", "value": "Below is my table, a User could have multiple profiles in certain languages, non-English profiles have a higher priority.\n\n+----------+--------+----------------+----------------+\n|ProfileID |UserID |ProfileLanguage |ProfilePriority |\n+----------+--------+----------------+--...
What causes the publish error: "fl.getDocumentDOM() has no properties" ? The error occurs only when using the "Test Project" button in the project pane. It doesn't cause the publish to fail, it's just annoying.
The error message "fl.getDocumentDOM() has no properties" typically indicates that there is a problem accessing the Document Object Model (DOM) of the current document in Adobe Flash (now Adobe Animate). This kind of error often arises when the environment doesn't properly reference or access the document context. Her...
47,091
[ { "from": "human", "value": "What causes the publish error:\n\"fl.getDocumentDOM() has no properties\" ?\nThe error occurs only when using the \"Test Project\" button in the project pane. It doesn't cause the publish to fail, it's just annoying.\n" }, { "from": "gpt", "value": "The error message...
I am new to asp.net. I am working on an application that is doing system transactions. At some point in code an exception is raised and the code bombs out. It bombs out when clicking on a particular row record in a grid list. However after the user sees the exception...they go back and try to click some other record...
Yes, what you are experiencing is likely related to the way exceptions are being handled in your ASP.NET application, possibly leading to an incorrect state being maintained in the session or page lifecycle. ### Understanding the Issue 1. **Exception Handling**: If an exception occurs and is not properly handled, th...
44,224
[ { "from": "human", "value": "I am new to asp.net. I am working on an application that is doing system transactions. At some point in code an exception is raised and the code bombs out. It bombs out when clicking on a particular row record in a grid list. However after the user sees the exception...they g...
Why does adding an "||" OR between 2 "!=" not work for me? When 'name' is "test" or "test2" my if statement doesn't work if I've used 2 "!=" but if I use just one it does, please tell me why. if (col.Name != "test" || col.Name != "test2") { MessageBox.Show("No" + col.Name.ToString()); //This shows "No test" and "No...
The behavior you're observing stems from the logic of the `||` (logical OR) operator and how the `!=` (not equal) operator works. ### Understanding the Conditions 1. When you use the condition: ```csharp if (col.Name != "test" || col.Name != "test2") ``` This will always evaluate to `true`, because of how...
46,542
[ { "from": "human", "value": "Why does adding an \"||\" OR between 2 \"!=\" not work for me? \nWhen 'name' is \"test\" or \"test2\" my if statement doesn't work if I've used 2 \"!=\" but if I use just one it does, please tell me why.\nif (col.Name != \"test\" || col.Name != \"test2\")\n {\n MessageBox.Show(...
I'm new to regular expressions and would appreciate your help. I'm trying to put together an expression that will split the example string using all spaces that are not surrounded by single or double quotes. My last attempt looks like this: (?!") and isn't quite working. It's splitting on the space before the quote. E...
To achieve the desired behavior of splitting a string on spaces that are not surrounded by single or double quotes, you can use a regular expression that takes into account the quotes. The key here is to use a combination of negative lookbehind and negative lookahead assertions to ensure that you are only splitting on ...
46,640
[ { "from": "human", "value": "I'm new to regular expressions and would appreciate your help. I'm trying to put together an expression that will split the example string using all spaces that are not surrounded by single or double quotes. My last attempt looks like this: (?!\") and isn't quite working. It's ...
I've long toyed with the idea of some kind of auto-cleanup page that performs routine maintenence tasks and is called out of scope of the current page execution by means of calling a 1x1 pixel gif with the asp.net page as the src parameter. One thing I've never really decided on, however, is how to handle the timing of...
Creating an auto-cleanup mechanism that runs routine maintenance tasks at specified intervals can be achieved using a combination of server-side state management and timed execution strategies. Here’s a structured approach to build this mechanism in an ASP.NET environment: ### 1. Use a Singleton Class To maintain sta...
42,760
[ { "from": "human", "value": "I've long toyed with the idea of some kind of auto-cleanup page that performs routine maintenence tasks and is called out of scope of the current page execution by means of calling a 1x1 pixel gif with the asp.net page as the src parameter. One thing I've never really decided on...
My scenario is: I have a WPF Window with 3 data-bound text boxes SettingsUI : Window <Grid Name="SettingsUIGrid1"> <TextBox Text="{Binding val1}" .... <TextBox Text="{Binding val2}" .... <TextBox Text="{Binding val3}" .... </Grid> In the constructor I do this: SettingsUIGrid1.DataContext = coll[0]; // col...
To manage the reloading of values in your WPF window and ensure that the updated values are reflected when you open the window again, you need to follow these steps: 1. **Implement a Clear or Reset Mechanism**: You should implement a method that resets the bound properties to their original values whenever the window ...
44,328
[ { "from": "human", "value": "My scenario is:\nI have a WPF Window with 3 data-bound text boxes\nSettingsUI : Window\n\n<Grid Name=\"SettingsUIGrid1\">\n <TextBox Text=\"{Binding val1}\" ....\n <TextBox Text=\"{Binding val2}\" ....\n <TextBox Text=\"{Binding val3}\" ....\n</Grid>\n\nIn the construct...
I use ls to obtain my filename which has white space so it looks something like: my file with whitespace.tar.bz2 I want to pipe this to tar similar to: ls | grep mysearchstring | tar xvjf How can I insert double quotes before piping it to tar?
When dealing with filenames that contain whitespace, you can handle them correctly by using `xargs` with `find` or by using a loop. However, if you specifically want to insert double quotes around the filenames and pipe them into `tar`, you can use the following approach: ### Using `xargs` You can use `xargs` with th...
46,560
[ { "from": "human", "value": "I use ls to obtain my filename which has white space so it looks something like: \nmy file with whitespace.tar.bz2\nI want to pipe this to tar similar to:\nls | grep mysearchstring | tar xvjf\n\nHow can I insert double quotes before piping it to tar?\n" }, { "from": "gpt...
I want to have a checkbox for terms and conditions, label of which should contain a link to a page with, well, terms and conditions. The following field will have the label with the tags escaped. BooleanField(label="I agree to <a href='terms-conditions.html'>terms&conditions</a>")
To create a checkbox for terms and conditions in a web form with a label that contains a link to the terms and conditions page, you'll need to ensure the HTML is properly formatted. However, you need to use Django's `BooleanField` correctly to include HTML in the label. In Django, it's important to render the label a...
48,448
[ { "from": "human", "value": "I want to have a checkbox for terms and conditions, label of which should contain a link to a page with, well, terms and conditions.\nThe following field will have the label with the tags escaped.\nBooleanField(label=\"I agree to <a href='terms-conditions.html'>terms&conditions<...
In my Page_Load event of codebehind file, I am loading data in to a datatable.In my .aspx page I am having some inline coding,I want to display some data from this datatable.But when i am running the program,It is showing an error like "Error 64 Use of unassigned local variable 'dtblChild' " dtblChild is my DataTable...
In ASP.NET Web Forms, the `Page_Load` event in the code-behind file executes after the server-side controls and elements on the ASPX page have been initialized but before the page is rendered and sent to the client. This means that by the time the page is being rendered, the `Page_Load` event has already fired. The er...
41,725
[ { "from": "human", "value": "In my Page_Load event of codebehind file, I am loading data in to a datatable.In my .aspx page I am having some inline coding,I want to display some data from this datatable.But when i am running the program,It is showing an error like \"Error 64 Use of unassigned local variab...
I've always wondered about when and where is the best time to cache a property value... Some of them seem pretty simple, like the one below... public DateTime FirstRequest { get { if (this.m_FirstRequest == null) { this.m_FirstRequest = DateTime.Now; } return (DateTime)this.m_Fir...
Caching property values is an important consideration in software design, especially when dealing with performance and resource management. The decision to cache a value, and how to manage that cache, depends on various factors. Let's discuss when and how to cache property values effectively, especially for the scenari...
42,645
[ { "from": "human", "value": "I've always wondered about when and where is the best time to cache a property value... Some of them seem pretty simple, like the one below...\npublic DateTime FirstRequest {\n get {\n if (this.m_FirstRequest == null) {\n this.m_FirstRequest = DateTime.Now;\...
I dont know if I'm right, but allmost everytime I read about obfuscation and tools that handle it, then its about C#, Java, Javascript and all other languages than VB. As I can see its equal important for me as a VB-developer to protect my code as an C#-developer. Have I missed something? Please dont flame me if it som...
You're absolutely right that code obfuscation is important for any developer, including VB (Visual Basic) developers. The tendency for most discussions and tools to focus on languages like C#, Java, and JavaScript does not diminish the importance of protecting VB code. Here are a few reasons you might not see as much ...
45,064
[ { "from": "human", "value": "I dont know if I'm right, but allmost everytime I read about obfuscation and tools that handle it, then its about C#, Java, Javascript and all other languages than VB.\nAs I can see its equal important for me as a VB-developer to protect my code as an C#-developer. Have I missed...
Now I know about the "normal" CSS list styles (roman, latin, etc) and certainly in years past they were somewhat inflexible in not allowing things like: (a) or a) only a. Now I believe that you can get an effect like the above with the :before and :after pseudo-elements. Is that correct? And whats the browser compat...
Yes, you can achieve custom list numbering and more complex hierarchical numbering styles in HTML using CSS and the `::before` and `::after` pseudo-elements. This gives you flexibility in formatting list items according to your requirements, such as report-style numbering. ### Example Implementation Here's how you c...
45,016
[ { "from": "human", "value": "Now I know about the \"normal\" CSS list styles (roman, latin, etc) and certainly in years past they were somewhat inflexible in not allowing things like:\n(a)\nor \na)\nonly\na.\nNow I believe that you can get an effect like the above with the :before and :after pseudo-elements...
I'd like to have my Eclipse plugin cause a URL to be opened by the users' default browser. This seems like pretty standard behavior, but I haven't been able to find any docs on how to do this. Can anyone help?
To open a URL in the user's default web browser from an Eclipse plugin, you can use the `org.eclipse.jface.util.Util` class, which provides a utility method to open a browser. Here is a simple example of how you can achieve this: 1. **Add the necessary imports**: Make sure to include the relevant Eclipse packages ...
45,303
[ { "from": "human", "value": "I'd like to have my Eclipse plugin cause a URL to be opened by the users' default browser. This seems like pretty standard behavior, but I haven't been able to find any docs on how to do this.\nCan anyone help?\n" }, { "from": "gpt", "value": "To open a URL in the us...
I'm wanting to save some OpenId fields to a database table, such as OpenId identifier Full Name Alias Email etc.. is there a place that summerizes the datatypes and lengths for all the common schema fields? I know there are custom ones (per provider) .. but what about the common ones? Eg. email -> nvarchar(250) .. or...
When designing a database schema for storing OpenID-related information, it's important to consider common fields and their appropriate data types and lengths. While specific requirements may vary based on the application and the identity providers, here's a summary of common OpenID fields and suggested database types ...
44,291
[ { "from": "human", "value": "I'm wanting to save some OpenId fields to a database table, such as\n\nOpenId identifier\nFull Name\nAlias\nEmail\netc..\n\nis there a place that summerizes the datatypes and lengths for all the common schema fields? I know there are custom ones (per provider) .. but what about ...
Is there an .net c# wrapper for the libFLAC library? If not, how can I read FLAC tags using the libFLAC in a .net framework c# application? If neither, are there other opensource libraries to read flac tags in c#? Thanks!
As of my last update, there isn't a widely recognized .NET wrapper specifically for the libFLAC library. However, you can still work with FLAC files and their metadata in C# through a couple of different approaches. ### Options for Reading FLAC Tags in C# 1. **Using `NAudio` Library:** NAudio is a popular audio li...
42,814
[ { "from": "human", "value": "Is there an .net c# wrapper for the libFLAC library? If not, how can I read FLAC tags using the libFLAC in a .net framework c# application? If neither, are there other opensource libraries to read flac tags in c#? \nThanks!\n" }, { "from": "gpt", "value": "As of my l...
I'm generating titles out of a few other fields, and want the "right" way to do: Me.Title.Value = Join(Array([Conference], [Speaker], partstr), " - ") Except any of [conference], [speaker] or partstr might be null, and I don't want the extra "-"'s. Are there any functions that'll make this job straightforward?
Certainly! If you're looking to concatenate strings in such a way that you avoid extra separators (like `"-"`), you can create a function to filter out `null` or empty values before joining them. Here’s a simple approach using a function that handles these conditions: ### Option 1: Using a Custom Function You can crea...
46,160
[ { "from": "human", "value": "I'm generating titles out of a few other fields, and want the \"right\" way to do:\nMe.Title.Value = Join(Array([Conference], [Speaker], partstr), \" - \")\n\nExcept any of [conference], [speaker] or partstr might be null, and I don't want the extra \"-\"'s. Are there any funct...
I have a table in a database that represents dates textually (i.e. "2008-11-09") and I would like to replace them with the UNIX timestamp. However, I don't think that MySQL is capable of doing the conversion on its own, so I'd like to write a little script to do the conversion. The way I can think to do it involves get...
MySQL does not natively support assigning temporary IDs during a `SELECT` query. However, you can accomplish your task by creating a temporary table or by using a subquery with a row number to uniquely identify each record. Here's how you can do this with a temporary table: 1. **Create a temporary table to hold the ...
46,178
[ { "from": "human", "value": "I have a table in a database that represents dates textually (i.e. \"2008-11-09\") and I would like to replace them with the UNIX timestamp. However, I don't think that MySQL is capable of doing the conversion on its own, so I'd like to write a little script to do the conversion...
I have typed dataset with 1:N relationship between two tables. Child table has 'Order' column, that I use for sorting (ordery by) in SP when loading data into dataset. As I understand, this order is not guaranteed when working with dataset. I need GetChildRows of parent row and ensure that rows are in specific order ...
When working with DataSets in .NET, as you noted, the order of rows returned by `GetChildRows` is not guaranteed. Your current approach of manually sorting the child rows after retrieving them is a common solution. However, if you want a more elegant or concise way to accomplish this while still ensuring the order base...
46,564
[ { "from": "human", "value": "I have typed dataset with 1:N relationship between two tables. \nChild table has 'Order' column, that I use for sorting (ordery by) in SP when loading data into dataset. As I understand, this order is not guaranteed when working with dataset. \nI need GetChildRows of parent row ...
Has anyone come across this issue? Seems MS have broken it with their own update: A number of people have reported problems using the ActiveX print control in the report viewer after installing Microsoft Update 956391. Specifically, users receive the error "Unable to load client print control" when clicki...
It looks like you're experiencing a known issue related to the ActiveX print control in the Microsoft Report Viewer after the installation of the Microsoft Update 956391. This issue has affected various applications that rely on the ReportViewer control, causing the "Unable to load client print control" error message. ...
45,275
[ { "from": "human", "value": "Has anyone come across this issue?\nSeems MS have broken it with their own update:\n\nA number of people have reported\n problems using the ActiveX print\n control in the report viewer after\n installing Microsoft Update 956391. \n Specifically, users receive the error\n \"...
Hey everyone. I'm trying to make a swing GUI with a button and a label on it. im using a border layout and the label ( in the north field ) shows up fine, but the button takes up the rest of the frame (it's in the center field). any idea how to fix this?
When using a `BorderLayout` in Java Swing, the components added to the `CENTER` position will indeed stretch to fill the available space in the container. If you want the button to maintain a specific size or not stretch to fill the entire center area, you can wrap it in a `JPanel` and set a layout for that `JPanel`. ...
45,937
[ { "from": "human", "value": "Hey everyone. I'm trying to make a swing GUI with a button and a label on it. im using a border layout and the label ( in the north field ) shows up fine, but the button takes up the rest of the frame (it's in the center field). any idea how to fix this?\n" }, { "from"...
I've been playing around with ASP.NET MVC and had a question. Or maybe its a concern that I am doing this wrong. Just working on a lame site to stretch my wings a bit. I am sorry this question is not at all concise. Ok, here's the scenario. When the user visits home/index, the page should show a list of products an...
Your question reflects a common source of confusion when working with ASP.NET MVC and rendering partial views. Let me break down the behavior you're observing and clarify why it's happening. ### Understanding View Location In ASP.NET MVC, when you call `Html.RenderPartial("Single", ...)`, the framework uses a specifi...
45,151
[ { "from": "human", "value": "I've been playing around with ASP.NET MVC and had a question. Or maybe its a concern that I am doing this wrong. Just working on a lame site to stretch my wings a bit. I am sorry this question is not at all concise.\nOk, here's the scenario. When the user visits home/index, ...
I would like to create a view similar to the "Now Playing" page on the iPhone and have 3 lines of text in the Navigation bar. The only way I could find to do this was: UINavigationBar *bar = [self.navigationController navigationBar]; label = [[UILabel alloc] initWithFrame:CGRectMake(60, 2, 200, 14)]; label.tag = SON...
You are on the right track! To achieve your goal of displaying three lines of text in the navigation bar similar to the "Now Playing" page on the iPhone, you should create a custom UIView that contains the three UILabels and set that custom view as the `titleView` of the navigation item. Here’s a step-by-step approach...
43,247
[ { "from": "human", "value": "I would like to create a view similar to the \"Now Playing\" page on the iPhone and have 3 lines of text in the Navigation bar.\nThe only way I could find to do this was:\nUINavigationBar *bar = [self.navigationController navigationBar]; \nlabel = [[UILabel alloc] initWithFram...
If I have code like this: public XALServiceConfiguration CreateInstance() { var config = ConfigurationManager.GetSection(ConfigurationSectionName) as XALServiceConfiguration; if (config == null) throw new ConfigurationErrorsException("Configuration element 'xalSer...
To test that the exception is thrown when the configuration section is missing, you can use a technique called mocking. This allows you to simulate the behavior of dependencies (in this case, the `ConfigurationManager`) without needing to modify the actual configuration file. However, Visual Studio 2008's built-in unit...
44,144
[ { "from": "human", "value": "If I have code like this:\n public XALServiceConfiguration CreateInstance()\n {\n var config = ConfigurationManager.GetSection(ConfigurationSectionName) as XALServiceConfiguration;\n if (config == null)\n throw new Configuration...
A recent question about string literals in .NET caught my eye. I know that string literals are interned so that different strings with the same value refer to the same object. I also know that a string can be interned at runtime: string now = DateTime.Now.ToString().Intern(); Obviously a string that is interned at ru...
In .NET, string literals are indeed interned, and they typically reside in the **heap**, specifically in the string intern pool managed by the Common Language Runtime (CLR). When you define a string literal in your code, the CLR handles it in such a way that it only allocates a single instance of that string with a par...
46,002
[ { "from": "human", "value": "A recent question about string literals in .NET caught my eye. I know that string literals are interned so that different strings with the same value refer to the same object. I also know that a string can be interned at runtime:\nstring now = DateTime.Now.ToString().Intern(); \...
I want to write out a text file. Instead of the default UTF-8, I want to write it encoded as ISO-8859-1 which is code page 28591. I have no idea how to do this... I'm writing out my file with the following very simple code: using (StreamWriter sw = File.CreateText(myfilename)) { sw.WriteLine("my text..."); sw.C...
To write a text file encoded in ISO-8859-1 (also known as Latin-1) using C#, you will need to use a different constructor of the `StreamWriter` class that allows you to specify the encoding. Here's how you can do this: 1. Use `StreamWriter` with a specific `Encoding` instance for ISO-8859-1. 2. Include the appropriate...
46,751
[ { "from": "human", "value": "I want to write out a text file.\nInstead of the default UTF-8, I want to write it encoded as ISO-8859-1 which is code page 28591. I have no idea how to do this...\nI'm writing out my file with the following very simple code:\nusing (StreamWriter sw = File.CreateText(myfilename)...
What is the purpose of this Rails config setting... config.action_controller.consider_all_requests_local = true It's set to true by default in config/environments/development.rb. Thanks, Ethan
The setting `config.action_controller.consider_all_requests_local` in a Ruby on Rails application is used to determine how error pages and debugging information are displayed for different types of requests. When this setting is set to `true`, it indicates that all requests (regardless of where they come from) should b...
46,442
[ { "from": "human", "value": "What is the purpose of this Rails config setting...\nconfig.action_controller.consider_all_requests_local = true\n\nIt's set to true by default in config/environments/development.rb.\nThanks,\nEthan\n" }, { "from": "gpt", "value": "The setting `config.action_controll...
In a previous life, I might have done something like this: <a href="#" onclick="f(311);return false;">Click</a><br/> <a href="#" onclick="f(412);return false;">Click</a><br/> <a href="#" onclick="f(583);return false;">Click</a><br/> <a href="#" onclick="f(624);return false;">Click</a><br/> Now with jQuery, I might do ...
Using the `alt` attribute for storing data in your HTML elements is not recommended because it is intended for specifying alternative text for images. Instead, you can use the `data-*` attributes, which are specifically designed to store custom data within HTML elements. Here’s how you can use `data-*` attributes in y...
44,921
[ { "from": "human", "value": "In a previous life, I might have done something like this:\n<a href=\"#\" onclick=\"f(311);return false;\">Click</a><br/>\n<a href=\"#\" onclick=\"f(412);return false;\">Click</a><br/>\n<a href=\"#\" onclick=\"f(583);return false;\">Click</a><br/>\n<a href=\"#\" onclick=\"f(624)...
Does anyone have some sample code showing how to POST to a URL using wxWidgets? The documentation and discussion forums imply that it's possible but the methods in wxHTTP are very low-level compared to what you find in .NET and scripting languages like Perl and Ruby. Do I actually have to create the HTTP request myself...
Yes, in wxWidgets, you can indeed perform HTTP POST requests, but it does require a bit more manual work compared to higher-level libraries in languages like .NET or scripting languages. While `wxHTTP` offers a basic interface for making HTTP requests, you can also use `wxCurl`, which provides a more straightforward w...
40,454
[ { "from": "human", "value": "Does anyone have some sample code showing how to POST to a URL using wxWidgets? The documentation and discussion forums imply that it's possible but the methods in wxHTTP are very low-level compared to what you find in .NET and scripting languages like Perl and Ruby. Do I actual...
We are considering switching from MS Visual Studio 2003 to MS Visual Studio 2005 for our C++ development. I think jumping to 2008 might be better. In what ways are VS2008 better than VS2005 for C++ development? Are there any disadvantages of VS2008 over VS2005?
Switching from MS Visual Studio 2003 to MS Visual Studio 2005 and then to 2008 can significantly enhance your C++ development experience. Here are some of the advantages of using Visual Studio 2008 over Visual Studio 2005, as well as some potential disadvantages: ### Advantages of Visual Studio 2008 over Visual Studio...
42,261
[ { "from": "human", "value": "We are considering switching from MS Visual Studio 2003 to MS Visual Studio 2005 for our C++ development. I think jumping to 2008 might be better.\nIn what ways are VS2008 better than VS2005 for C++ development?\nAre there any disadvantages of VS2008 over VS2005?\n" }, { ...
Heres the issue. I have a table(mySQL) that contains dates and some of them are null. I know that I can use DateTime? or Nullable to allow nulls, but I'm not sure where to set it. What I've tried: I built the class in the dblm. The date propery has the following attributes set: Nullable : True Server Data Type : DateT...
It seems you are trying to set up a class that maps to a MySQL database and handles nullable DateTime properties correctly. The `System.NullReferenceException` typically indicates that you are trying to access a property or method on an object that is `null`. Here are some steps to troubleshoot and set up your nullab...
44,411
[ { "from": "human", "value": "Heres the issue.\nI have a table(mySQL) that contains dates and some of them are null.\nI know that I can use DateTime? or Nullable to allow nulls, but I'm not sure where to set it. \nWhat I've tried:\nI built the class in the dblm. The date propery has the following attributes ...
I have recently started exploring Maven, but I feel a bit overwhelmed of all xml configuration in all the pom files. Are there any good tools i can use?
Absolutely, Maven can be overwhelming at first, especially with the amount of XML configuration in the `pom.xml` files. Fortunately, there are several tools and IDE plugins that can help simplify the experience when working with Maven: 1. **IDE Support**: - **IntelliJ IDEA**: If you're using IntelliJ IDEA, it has e...
45,032
[ { "from": "human", "value": "I have recently started exploring Maven, but I feel a bit overwhelmed of all xml configuration in all the pom files. Are there any good tools i can use?\n" }, { "from": "gpt", "value": "Absolutely, Maven can be overwhelming at first, especially with the amount of XML...
I have some code that opens a word document using VBScript on an ASP.net page: set objWord = CreateObject("Word.Application") objWord.Visible = True objWord.Documents.Open "c:\inetpub\wwwroot\JSWordTest\test.doc", False, False, False This works great but opens the word doc in another window. Ideally I would like to ...
Displaying a Word document within a webpage in such a way that it can be manipulated using VBScript is quite challenging due to how web browsers handle applications and ActiveX controls. Browsers like Chrome, Firefox, and others do not natively support ActiveX controls, which are required for VBScript to interact with ...
40,829
[ { "from": "human", "value": "I have some code that opens a word document using VBScript on an ASP.net page:\nset objWord = CreateObject(\"Word.Application\")\n\nobjWord.Visible = True\n\nobjWord.Documents.Open \"c:\\inetpub\\wwwroot\\JSWordTest\\test.doc\", False, False, False\n\nThis works great but opens ...
I want to test some PHP on my local machine running Windows XP Professional. I'm familiar with coding PHP for upload, but not with running a web server. What is the easiest way to set up a test environment? Step-by-step instructions would be great if you can give them. (I see WAMP recommended in this thread - thoughts?...
Setting up a local PHP development environment on Windows XP is quite straightforward, especially if you choose a package like WAMP or XAMPP. Here are step-by-step instructions for both options. Since you mentioned you found XAMPP useful, I'll start with that. ### Option 1: Using XAMPP 1. **Download XAMPP**: - Vi...
44,001
[ { "from": "human", "value": "I want to test some PHP on my local machine running Windows XP Professional. I'm familiar with coding PHP for upload, but not with running a web server.\nWhat is the easiest way to set up a test environment? Step-by-step instructions would be great if you can give them.\n(I see ...
I want to otherwise block code execution on the main thread while still allowing UI changes to be displayed. I tried to come up with a simplified example version of what I'm trying to do; and this is the best I could come up with. Obviously it doesn't demonstrate the behavior I'm wanting or I wouldn't be posting the qu...
To achieve your goal of blocking the main thread while still allowing UI updates to be displayed, you need to avoid using `WaitOne()` on the `AutoResetEvent` that can lead to deadlocks. Instead, consider using asynchronous programming with `async` and `await`. This approach allows you to perform long-running tasks on a...
47,309
[ { "from": "human", "value": "I want to otherwise block code execution on the main thread while still allowing UI changes to be displayed.\nI tried to come up with a simplified example version of what I'm trying to do; and this is the best I could come up with. Obviously it doesn't demonstrate the behavior I...
Having trouble linking the Stomp.framework into an iPhone SDK application. http://code.google.com/p/stompframework/ I follow the instructions, adding it to the project, adding a Build Phase for Copying the Files, and including it via #import . I keep getting "image not found". Anyone try this and/or have a clear idea w...
If you're encountering an "image not found" error when trying to link the Stomp.framework into your iPhone SDK application, there are a few steps you can take to troubleshoot and resolve the issue. Here’s a checklist to ensure that everything is set up correctly: ### 1. **Check Framework Location** Make sure that t...
45,139
[ { "from": "human", "value": "Having trouble linking the Stomp.framework into an iPhone SDK application.\nhttp://code.google.com/p/stompframework/\nI follow the instructions, adding it to the project, adding a Build Phase for Copying the Files, and including it via #import .\nI keep getting \"image not found...
I have a community site which has around 10,000 listings at the moment. I am adopting a new url strategy something like example.com/products/category/some-product-name As part of strategy, I am implementing a site map. Google already has a good index of my site, but the URLs will change. I use a php framework which ac...
It's great that you are considering a new URL strategy and sitemap implementation. There are several points to consider regarding performance, indexing, and your URL structure when transitioning to new URLs. ### 1. **Performance and Indexing Concerns:** - **Performance Impact:** Generally, updating URLs shouldn't i...
44,130
[ { "from": "human", "value": "I have a community site which has around 10,000 listings at the moment. I am adopting a new url strategy something like\nexample.com/products/category/some-product-name\n\nAs part of strategy, I am implementing a site map. Google already has a good index of my site, but the URLs...
One thing I really like about AS3 over AS2 is how much more compile-time type-checking it adds. However, it seems to be somewhat lacking in that there is no type-checked enumeration structure available. What's a good (best / accepted) way to do custom enumerated types in AS3?
In ActionScript 3 (AS3), while there is no built-in enumerated type structure like in some other languages, you can effectively create your own enum-like structure using a combination of constants, classes, or even simple objects. Here are a few accepted methods to create custom enumerated types in AS3: ### Method 1: ...
44,436
[ { "from": "human", "value": "One thing I really like about AS3 over AS2 is how much more compile-time type-checking it adds. However, it seems to be somewhat lacking in that there is no type-checked enumeration structure available. What's a good (best / accepted) way to do custom enumerated types in AS3?\n"...
Can someone please let me know how do I implement "Did you mean" feature in Lucene.net? Thanks!
Implementing a "Did you mean" feature in Lucene.NET typically involves a few key components: capturing user input, analyzing it for potential spelling mistakes, generating suggestions, and displaying these suggestions. Here's a basic approach to accomplish this: ### Steps to Implement "Did You Mean" Feature 1. **Setu...
41,581
[ { "from": "human", "value": "Can someone please let me know how do I implement \"Did you mean\" feature in Lucene.net?\nThanks!\n" }, { "from": "gpt", "value": "Implementing a \"Did you mean\" feature in Lucene.NET typically involves a few key components: capturing user input, analyzing it for p...
I'm calling this linear class relationship, but correct me if I'm wrong. I'm looking to test whether or not the class of object A is an ancestor or descendant of object B's class. For example, AbstractCollection is linearly related to both Object and ArrayList. However, ArrayList is not linearly related to Vector. My f...
The code snippet you provided is a reasonable start for checking whether one class is an ancestor or descendant of another class in Java. However, there are a few clarifications and adjustments you might want to consider. To determine whether class `A` is a superclass of class `B`, or vice versa, you can use `isAssign...
45,092
[ { "from": "human", "value": "I'm calling this linear class relationship, but correct me if I'm wrong. I'm looking to test whether or not the class of object A is an ancestor or descendant of object B's class.\nFor example, AbstractCollection is linearly related to both Object and ArrayList. However, ArrayLi...
I have a configuration file where a developer can specify a text color by passing in a string: <text value="Hello, World" color="Red"/> Rather than have a gigantic switch statement look for all of the possible colors, it'd be nice to just use the properties in the class System.Drawing.Brushes instead so internally I ...
You're correct that the `Brushes` class does not use an enum, and therefore you can't use `Enum.Parse` to achieve your goal. However, you can achieve similar functionality using reflection to dynamically retrieve the properties of the `Brushes` class. Here's a way to do that: 1. Use reflection to get the `PropertyInfo...
46,083
[ { "from": "human", "value": "I have a configuration file where a developer can specify a text color by passing in a string:\n <text value=\"Hello, World\" color=\"Red\"/>\n\nRather than have a gigantic switch statement look for all of the possible colors, it'd be nice to just use the properties in the class...
I have written a function that gets a given number of random records from a list. Currently I can do something like: IEnumerable<City> cities = db.Cites.GetRandom(5); (where db is my DataContext connecting to a SQL Server DB) Currently, I have a function like this in every entity I need random records from: public pa...
The issue you're facing stems from the constraints of using LINQ to SQL's `Table<T>` type. Specifically, the generic type `T` does not have a constraint that requires it to be a reference type, which is necessary in this context. To resolve this, you can add a constraint to your generic method to ensure that `T` is a ...
46,313
[ { "from": "human", "value": "I have written a function that gets a given number of random records from a list. Currently I can do something like:\nIEnumerable<City> cities = db.Cites.GetRandom(5);\n\n(where db is my DataContext connecting to a SQL Server DB)\nCurrently, I have a function like this in every...
So, I've cached a value using the ASP.NET Cache object, with the following code: Cache.Insert("TEST_VALUE", 150, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(120)); As I understand it, this should mean that if nothing accesses that object for 120 seconds, it will expire and return null. However, if after 10...
Your understanding of how the ASP.NET Cache object works seems mostly correct, but there are a few considerations to keep in mind. 1. **Sliding Expiration**: The `Cache.Insert` method you're using with the parameters you specified does set a **sliding expiration** of 120 seconds. This means that the cache item will on...
47,798
[ { "from": "human", "value": "So, I've cached a value using the ASP.NET Cache object, with the following code:\nCache.Insert(\"TEST_VALUE\", 150, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(120)); \n\nAs I understand it, this should mean that if nothing accesses that object for 120 seconds, it wil...
http://leepoint.net/notes-java/data/expressions/22compareobjects.html It turns out that defining equals() isn't trivial; in fact it's moderately hard to get it right, especially in the case of subclasses. The best treatment of the issues is in Horstmann's Core Java Vol 1. If equals() must always be overridd...
The desire to compare two objects typically arises from several fundamental reasons, including: 1. **Identity Verification**: Ensuring that two references point to the same object in memory. 2. **Value Comparison**: Determining whether two objects have equivalent properties or data values. 3. **Sorting and Ordering**:...
44,706
[ { "from": "human", "value": "http://leepoint.net/notes-java/data/expressions/22compareobjects.html\n\nIt turns out that defining equals()\n isn't trivial; in fact it's moderately\n hard to get it right, especially in\n the case of subclasses. The best\n treatment of the issues is in\n Horstmann's Core ...
Trying to follow a technique found at bzr and gitosis I did the following: added to ~/.ssh/authorized_keys the command="my_parser" parameter which point to a python script file named 'my_parser' and located in /usr/local/bin (file was chmoded as 777) in that script file '/usr/local/bin/my_parser' I got the following ...
When you set up an SSH key with a command restriction (like you did with the `command="my_parser"` option in your `~/.ssh/authorized_keys` file), that command will be executed instead of starting a typical shell session. However, to get the `SSH_ORIGINAL_COMMAND` environment variable, you must connect to the server wit...
46,897
[ { "from": "human", "value": "Trying to follow a technique found at bzr and gitosis I did the following:\nadded to ~/.ssh/authorized_keys the command=\"my_parser\" parameter\nwhich point to a python script file named 'my_parser' and located in \n/usr/local/bin (file was chmoded as 777)\nin that script file ...
I have a few huge tables on a production SQL 2005 DB that need a schema update. This is mostly an addition of columns with default values, and some column type change that require some simple transformation. The whole thing can be done with a simple "SELECT INTO" where the target is a table with the new schema. Our tes...
Updating large tables with millions of rows in SQL Server 2005 can indeed be a challenge, especially when you're making schema changes that involve transformations. Here are several strategies you can consider to improve the performance of your schema update process: ### 1. Use Batch Processing Instead of trying to co...
44,483
[ { "from": "human", "value": "I have a few huge tables on a production SQL 2005 DB that need a schema update. This is mostly an addition of columns with default values, and some column type change that require some simple transformation. The whole thing can be done with a simple \"SELECT INTO\" where the tar...
Sometimes when I am debugging code in Eclipse it happens that although I can see and inspect class member variables without any difficulty I am unable to inspect the values of variables declared locally within functions. As an aside, any parameters to the current function lose their 'real' names and instead one sees th...
The behavior you're experiencing in Eclipse while debugging Java code, particularly with local variables not being inspectable, can have several potential causes. Here are some things to consider: ### 1. **Debug Information Level:** - Ensure that your project is compiled with debug information included. If you're u...
33,090
[ { "from": "human", "value": "Sometimes when I am debugging code in Eclipse it happens that although I can see and inspect class member variables without any difficulty I am unable to inspect the values of variables declared locally within functions. As an aside, any parameters to the current function lose t...
I remember seeing in a sample a while ago that it is possible to break up a windsor configuration file into multiple ones and reference them from the app.config in a way that they get parsed automatically. Of course I didn't bookmark it and now I can't find it and my Windsor.Config.xml file is creeping up on 600 lines....
In Castle Windsor, it's indeed possible to break your configuration into multiple XML files and include them in a single Windsor configuration file. You can achieve this by using the `include` element within your `Windsor.Config.xml` file. Here's a step-by-step guide on how to do this: ### Step 1: Create Multiple Con...
44,753
[ { "from": "human", "value": "I remember seeing in a sample a while ago that it is possible to break up a windsor configuration file into multiple ones and reference them from the app.config in a way that they get parsed automatically.\nOf course I didn't bookmark it and now I can't find it and my Windsor.Co...
My father has found a Russian language keyboard mapping that he really likes here. However, it is non-standard and therefore is not one that appears in the Languages (Control Panel->Regional and Language Options->Languages->Details->Text Services And Input Languages->Add) dropdown for keyboard layout selection. To my...
Creating a custom keyboard layout on Windows can indeed be done by editing XML files, but it may require some additional steps. Here’s a general guide on how to create a new keyboard layout and, if needed, an alternative method for emulating a custom mapping using a program. ### Creating a Custom Keyboard Layout 1. *...
40,058
[ { "from": "human", "value": "My father has found a Russian language keyboard mapping that he really likes here. However, it is non-standard and therefore is not one that appears in the Languages (Control Panel->Regional and Language Options->Languages->Details->Text Services And Input Languages->Add) dropd...
I have DataTemplate containing a TextBox. I'm setting this template to a listbox item on a selection. I'm unable to set focus to textbox in the template. I tried to call MyTemplate.FindName, but it ends up with an Invalid Operation Exception: This operation is valid only on elements that have this template applied. How...
To set focus to a `TextBox` within a `DataTemplate` that is applied to a `ListBox` item, you need to consider how WPF handles templates. When you apply a `DataTemplate` to an item in a `ListBox`, the `TextBox` is instantiated only when the item is generated, which means you cannot access it directly using `FindName` on...
43,744
[ { "from": "human", "value": "I have DataTemplate containing a TextBox. I'm setting this template to a listbox item on a selection.\nI'm unable to set focus to textbox in the template. I tried to call MyTemplate.FindName, but it ends up with an Invalid Operation Exception: This operation is valid only on ele...
My professor assigned a project where a simulation is ran through a GUI. To edit it, we need to create a "New" menu item. We haven't learned how to get data from a GUI, and our book does not cover it at all. What I'm trying to do, is when the "New" command is hit, focus gets shifted back to the CMD prompt, where Syste...
Creating a GUI application that interacts with the command line (CMD) can be quite challenging because GUI frameworks typically run on a different event loop than standard console I/O. Here are some strategies you can consider to implement the behavior you described: ### Option 1: Use a Separate Thread You can run th...
43,955
[ { "from": "human", "value": "My professor assigned a project where a simulation is ran through a GUI. To edit it, we need to create a \"New\" menu item. We haven't learned how to get data from a GUI, and our book does not cover it at all. \nWhat I'm trying to do, is when the \"New\" command is hit, focus ge...
I want to profile (keep an Eye on) all the activities that goes on in a Database which is in PostgreSQL. Is there any such utility which will help me do this?
Yes, PostgreSQL provides several tools and features that can help you monitor and profile activities within your database. Here are some options: 1. **pg_stat_statements**: This is an extension that provides a means for tracking execution statistics of all SQL statements executed by a server. It can help you identify ...
45,293
[ { "from": "human", "value": "I want to profile (keep an Eye on) all the activities that goes on in a Database which is in PostgreSQL.\nIs there any such utility which will help me do this?\n" }, { "from": "gpt", "value": "Yes, PostgreSQL provides several tools and features that can help you moni...
Today I found out that putting strings in a resource file will cause them to be treated as literals, i.e putting "Text for first line \n Text for second line" will cause the escape character itself to become escaped, and so what's stored is "Text for first line \n Text for second line" - and then these come out in the ...
In C#, if you've stored a string in a resource file and you want to convert escape sequences like `\n` into actual newline characters, you'll need to use a combination of escaping and string replacement. The issue arises because when you save a string like `"Text for first line \\n Text for second line"` in a resource...
45,338
[ { "from": "human", "value": "Today I found out that putting strings in a resource file will cause them to be treated as literals, i.e putting \"Text for first line \\n Text for second line\" will cause the escape character itself to become escaped, and so what's stored is \"Text for first line \\n Text for ...
When a webpage has moved to a new location, how do I show the moved web page AND return a 301 permanent redirect HTTP response status code in Django?
In Django, if you want to move a webpage to a new location and inform clients (and search engines) that the page has permanently moved, you can use the `HttpResponsePermanentRedirect` class or the `redirect()` shortcut function with the appropriate URL. This will send a 301 status code indicating a permanent redirect. ...
46,793
[ { "from": "human", "value": "When a webpage has moved to a new location, how do I show the moved web page AND return a 301 permanent redirect HTTP response status code in Django?\n" }, { "from": "gpt", "value": "In Django, if you want to move a webpage to a new location and inform clients (and s...
I'm using ADO.NET dataservices in a Silverlight application and since the silverlight libraries don't support the ToList() call on the IQueryable I thought it might be possible to create an extension method around this called SilverlightToList(). So in this method I'm calling the BeginExecute method on my context as sh...
Yes, the issue you're experiencing is a common problem when dealing with asynchronous programming in Silverlight, particularly when using blocking calls like `WaitOne()`. In a Silverlight application, the main UI thread is responsible for rendering the user interface, and blocking this thread can lead to a deadlock sit...
45,719
[ { "from": "human", "value": "I'm using ADO.NET dataservices in a Silverlight application and since the silverlight libraries don't support the ToList() call on the IQueryable I thought it might be possible to create an extension method around this called SilverlightToList(). So in this method I'm calling th...
Just started getting a bunch of errors on our C# .Net app that seemed to be happening for no reason. Things like System.IndexOutOfRangeException on a SqlDataReader object for an index that should be returned and has been returning for a while now. Anyways, I looked at the Task Manager and saw that sqlservr.exe was runn...
High memory usage in SQL Server, such as the 1,500,000 K (or 1.5 GB) you observed, is not unusual for a SQL Server instance, especially if it has been configured to utilize available memory resources. SQL Server is designed to use available memory to improve performance by caching data and execution plans. However, in ...
46,260
[ { "from": "human", "value": "Just started getting a bunch of errors on our C# .Net app that seemed to be happening for no reason. Things like System.IndexOutOfRangeException on a SqlDataReader object for an index that should be returned and has been returning for a while now.\nAnyways, I looked at the Task ...
Does anyone know if there's a de-facto standard (i.e., TR1 or Boost) C++ function object for accessing the elements of a std::pair? Twice in the past 24 hours I've wished I had something like the keys function for Perl hashes. For example, it would be nice to run std::transform on a std::map object and dump all the k...
In C++, there isn't a standard function object specifically for accessing the elements of `std::pair` like there is in some other languages (e.g., Perl for hashes). However, there are some tools in the C++ Standard Library and Boost that can help you achieve your goal. ### Using Standard Library In C++, you can creat...
46,085
[ { "from": "human", "value": "Does anyone know if there's a de-facto standard (i.e., TR1 or Boost) C++ function object for accessing the elements of a std::pair? Twice in the past 24 hours I've wished I had something like the keys function for Perl hashes. For example, it would be nice to run std::transfor...
I want to control/override the auto-complete feature when a user enters text in my iPhone app. Specifically I'd like to auto-complete a collection of words I supply. For example say my name is BillBobJohn. When I type "billb" auto-complete will suggest BillBobJohn. How can I do this?
To implement a custom auto-complete feature in your iPhone app that overrides the default keyboard auto-complete suggestions, you'll generally want to leverage a few components provided by iOS. You can use a combination of `UITextField` or `UITextView` along with a custom auto-complete suggestion view (e.g., a table vi...
41,277
[ { "from": "human", "value": "I want to control/override the auto-complete feature when a user enters text in my iPhone app.\nSpecifically I'd like to auto-complete a collection of words I supply. For example say my name is BillBobJohn. When I type \"billb\" auto-complete will suggest BillBobJohn.\nHow can ...
I have a simple app loading a site optimized for the iPhone in a UIWebView. Problem is, caching does not seem to work: [webView loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: url] cachePolicy: NSURLRequestUseProtocolCachePolicy ...
Caching issues in UIWebView can be tricky, especially when you're working with various external resources such as CSS, images, and JavaScript files. Here are some steps and best practices that you can try to improve caching behavior in your UIWebView: ### 1. Use Proper Cache-Control Headers Ensure that the server host...
42,291
[ { "from": "human", "value": "I have a simple app loading a site optimized for the iPhone in a UIWebView.\nProblem is, caching does not seem to work:\n[webView loadRequest: [NSURLRequest requestWithURL: [NSURL URLWithString: url]\n cachePolicy: NSURLRequestUseProtocolCac...
How do you pass "this" to the constructor for ObjectDataProvider in XAML. Lets say my presenter class is: public class ApplicationPresenter(IView view){} and that my UserControl implements IView. What do I pass to the ConstructorParameters in the code below so that the UserControl can create the ApplicationPresenter u...
In XAML, you can't directly pass "this" (the current instance of your UserControl) to the constructor of `ApplicationPresenter` because XAML is not designed to reference the instance of the control being created. However, you can use a `StaticResource` to provide a binding to the `UserControl` instance that can be pass...
42,170
[ { "from": "human", "value": "How do you pass \"this\" to the constructor for ObjectDataProvider in XAML.\nLets say my presenter class is:\npublic class ApplicationPresenter(IView view){}\n\nand that my UserControl implements IView.\nWhat do I pass to the ConstructorParameters in the code below so that the U...
I am trying to convert this test code to C# and having a problem with the Trim command. Has anyone done anything similiar like this in C# going to use this with a text box for searching the aspx page. Dim q = From b In db.Blogs _ Where b.BlogContents.Contains(txtSearch.Text.Trim()) Or _ ...
Certainly! You can convert the given VB.NET LINQ query to C# quite easily. In C#, the equivalent LINQ query would look something like this: ```csharp var q = from b in db.Blogs where b.BlogContents.Contains(txtSearch.Text.Trim()) || b.BlogTitle.Contains(txtSearch.Text.Trim()) select b; `...
42,274
[ { "from": "human", "value": "I am trying to convert this test code to C# and having a problem with the Trim command. Has anyone done anything similiar like this in C# going to use this with a text box for searching the aspx page. \nDim q = From b In db.Blogs _\n Where b.BlogContents.Contains...
When writeing unit tests for a single class that contains other objects what's the best way to use mock objects to avoid tests dependant on other classes. Example 1: public class MyClass { protected MyObject _obj; public MyClass() { _obj = new MyObject(); } public object DoSomething() { ...
When writing unit tests for classes that depend on other objects, it's essential to use mock objects effectively to isolate the class being tested. Here are some best practices to achieve this without exposing implementation details such as protected members or method parameters. ### General Approach: 1. **Dependenc...
42,296
[ { "from": "human", "value": "When writeing unit tests for a single class that contains other objects what's the best way to use \nmock objects to avoid tests dependant on other classes. \nExample 1:\npublic class MyClass\n{\n protected MyObject _obj;\n\n public MyClass()\n {\n _obj = new MyObjec...
Hi i would to know how to se up a svn server? Now, i'm using VisualSVN a TortoiseSVN, but i don't know what are the directories "branch" "trunk" "tags". Can anyone explain me how it works? I read the svn book and many sites articles about it but i don't understand.
Setting up an SVN (Subversion) server and understanding the directory structure can indeed be a bit confusing at first. I'll walk you through the key concepts of SVN, including the directory structure, and then provide a brief overview of how to set up an SVN server. ### SVN Directory Structure: Branch, Trunk, and Tag...
44,067
[ { "from": "human", "value": "Hi i would to know how to se up a svn server? Now, i'm using VisualSVN a TortoiseSVN, but i don't know what are the directories \"branch\" \"trunk\" \"tags\".\nCan anyone explain me how it works?\nI read the svn book and many sites articles about it but i don't understand.\n" ...
What is the most efficient way of setting values in C# multi-dimensional arrays using a linear index? For example given an array... int[,,] arr2 = { {{0,1,2}, {3,4,5}, {6,7,8}} , {{9,10,11}, {12,13,14}, {15,16,17}} , {{18,19,20}, {21,22,23}, {24,25,26}} }; How do I set all the...
Your implementation for setting the values in a multi-dimensional array using a linear index is quite thorough, especially with the consideration of arbitrary dimensions. However, there is a more straightforward and efficient way to achieve this without needing to calculate cumulative lengths and perform more complex a...
44,450
[ { "from": "human", "value": "What is the most efficient way of setting values in C# multi-dimensional arrays using a linear index? For example given an array...\nint[,,] arr2 = { {{0,1,2}, {3,4,5}, {6,7,8}}\n , {{9,10,11}, {12,13,14}, {15,16,17}}\n , {{18,19,20}, {21,22,23}, ...
Is there an easy way to delete an element from an array using PHP, such that foreach ($array) no longer includes that element? I thought that setting it to null would do it, but apparently it does not work.
In PHP, if you want to remove an element from an array such that it no longer appears in a `foreach` loop, you can't simply set the element to `null`. Instead, you should use functions like `unset()` to remove the element from the array entirely. Here's how you can do it: ### Example ```php $array = [1, 2, 3, 4, 5];...
47,339
[ { "from": "human", "value": "Is there an easy way to delete an element from an array using PHP, such that foreach ($array) no longer includes that element?\nI thought that setting it to null would do it, but apparently it does not work.\n" }, { "from": "gpt", "value": "In PHP, if you want to rem...
What software does everyone use to monitor hardware? I know about nagios and cacti, but does anyone use any other software?
Yes, there are several other software tools used for monitoring hardware and system performance beyond Nagios and Cacti. Here are some popular options: 1. **Zabbix**: An open-source monitoring solution for networks and applications, Zabbix is known for its flexibility and scalability. It can monitor various hardware m...
46,102
[ { "from": "human", "value": "What software does everyone use to monitor hardware? I know about nagios and cacti, but does anyone use any other software?\n" }, { "from": "gpt", "value": "Yes, there are several other software tools used for monitoring hardware and system performance beyond Nagios ...
Is there a way to enforce explicit cast for typedefs of the same type? I've to deal with utf8 and sometimes I get confused with the indices for the character count and the byte count. So it be nice to have some typedefs: typedef unsigned int char_idx_t; typedef unsigned int byte_idx_t; With the addition that you need ...
In C, you cannot directly enforce explicit casts between typedefs of the same underlying type, but you can use a combination of struct wrappers and inline functions to achieve a similar effect. By wrapping the types in structs, you can ensure that implicit conversions are not possible, thus forcing explicit casts. Her...
47,533
[ { "from": "human", "value": "Is there a way to enforce explicit cast for typedefs of the same type? I've to deal with utf8 and sometimes I get confused with the indices for the character count and the byte count. So it be nice to have some typedefs:\ntypedef unsigned int char_idx_t;\ntypedef unsigned int by...
Since IronPython doesn't support attributes I am wondering if there is another way to decorate IronPython classes with attributes, perhaps with reflection?
In IronPython, you cannot directly use traditional attribute decorators like you would in CPython due to the lack of native support for attributes on classes. However, you can still work with a workaround using .NET reflection to achieve similar functionality. One common approach is to create a custom decorator that u...
44,482
[ { "from": "human", "value": "Since IronPython doesn't support attributes I am wondering if there is another way to decorate IronPython classes with attributes, perhaps with reflection?\n" }, { "from": "gpt", "value": "In IronPython, you cannot directly use traditional attribute decorators like y...
I need a font that shows letters and function keys on a keyboard, so that I can show Ctrl+Alt+S as 3 separate keys on a keyboard, not as the text. I've looked at two, and one of them had lots of missing keys (among other things, the Win key), the other one cost over $100. Any good ideas? Oh, and this needs to be a true...
Finding a suitable font that includes keys and function keys for keyboard representation can be a bit challenging, especially if you're looking for something free or low-cost that you can redistribute. Here are a few options you might consider: ### Free Options: 1. **Keyboard Font**: - There are various keyboard f...
45,245
[ { "from": "human", "value": "I need a font that shows letters and function keys on a keyboard, so that I can show Ctrl+Alt+S as 3 separate keys on a keyboard, not as the text.\nI've looked at two, and one of them had lots of missing keys (among other things, the Win key), the other one cost over $100.\nAny ...
I'm using this article to start a process on a remote machine using WMI. How can I control the working directory that process will start in? (No need to redirect me to psexec, I'm getting an error from it, currently trying the WMI approach).
When using WMI (Windows Management Instrumentation) to start a process on a remote machine, you can control the working directory of the process by specifying the `CurrentDirectory` property when invoking the `Win32_Process` class's `Create` method. The `Create` method allows you to specify parameters for the process y...
47,462
[ { "from": "human", "value": "I'm using this article to start a process on a remote machine using WMI. How can I control the working directory that process will start in?\n(No need to redirect me to psexec, I'm getting an error from it, currently trying the WMI approach).\n" }, { "from": "gpt", "...
I need to purchase SQL Server 2008 Standard edition, because it's features fit what I need. On the features page, it says it can handle 32,767 user connections, but how does that connect with CALs? What are CALs and how can they affect a project?
When considering SQL Server 2008 Standard Edition, it's important to understand the licensing model, particularly regarding Client Access Licenses (CALs). Here's a breakdown of what CALs are and how they relate to user connections: ### What are CALs? **Client Access Licenses (CALs)** are licenses that allow users or ...
44,691
[ { "from": "human", "value": "I need to purchase SQL Server 2008 Standard edition, because it's features fit what I need. On the features page, it says it can handle 32,767 user connections, but how does that connect with CALs?\nWhat are CALs and how can they affect a project?\n" }, { "from": "gpt", ...
Can anyone explain the meaning of and purposes of the values for the SecurityAction enum? The MSDN page is not terribly clear. It says LinkDemand occurs at just-in-time compilation whereas Demand occurs at runtime. Why the distinction and in what situations would I use LinkDemand as opposed to Demand? Likewise, what ar...
The `SecurityAction` enum in .NET defines various types of security actions that can be used to control and enforce security policy at runtime. Here’s a breakdown of the different values, their meanings, and typical use cases. ### SecurityAction Enum Values 1. **LinkDemand**: - **Meaning**: Requires that all call...
42,763
[ { "from": "human", "value": "Can anyone explain the meaning of and purposes of the values for the SecurityAction enum?\nThe MSDN page is not terribly clear. It says LinkDemand occurs at just-in-time compilation whereas Demand occurs at runtime.\nWhy the distinction and in what situations would I use LinkDem...
Problem: I am looking for a way to run a test that is able to disambiguate between select controls that have the same value in more than one place. Example: I am trying to choose the third "monday" from a select control ie.select_list( :id , 'choose-day' ).set( '-monday' ); where the select control has a kind of "out...
To select the third occurrence of an option with the same visible text from a `select` control, you'll need to use a method to iterate through the options and select the one you want based on its index. Here's an approach using Ruby with Capybara, which allows for web-based testing: ```ruby # First, locate the selec...
47,924
[ { "from": "human", "value": "Problem: I am looking for a way to run a test that is able to disambiguate between select controls that have the same value in more than one place.\nExample: \nI am trying to choose the third \"monday\" from a select control\nie.select_list( :id , 'choose-day' ).set( '-monday' )...
Does anyone know of an algorithm (or search terms / descriptions) to locate a known image within a larger image? e.g. I have an image of a single desktop window containing various buttons and areas (target). I also have code to capture a screen shot of the current desktop. I would like an algorithm that will help me ...
To locate a known image (target) within a larger image (source), especially when the images might not match exactly due to variations in rendering, you can use several techniques in computer vision. Here are some approaches and related search terms or descriptions that could help you achieve your goal: ### 1. **Templa...
43,584
[ { "from": "human", "value": "Does anyone know of an algorithm (or search terms / descriptions) to locate a known image within a larger image?\ne.g.\nI have an image of a single desktop window containing various buttons and areas (target). I also have code to capture a screen shot of the current desktop. I...
I'm using the File::Find module to traverse a directory tree. Once I find a specific file, I want to stop searching. How can I do that? find (\$processFile, $mydir); sub processFile() { if ($_ =~ /target/) { # How can I return from find here? } }
When using the `File::Find` module in Perl, you can stop the traversal by setting a special variable. In your case, you can use the variable `$File::Find::prune` to stop the search once you find the specific file you're looking for. Here's how you can modify your `processFile` subroutine to achieve this: ```perl use ...
47,770
[ { "from": "human", "value": "I'm using the File::Find module to traverse a directory tree. Once I find a specific file, I want to stop searching. How can I do that?\n find (\\$processFile, $mydir);\n\n sub processFile() {\n if ($_ =~ /target/) {\n # How can I return from find here?\n ...
we're dealing with a very slow update statement in an Oracle project. Here's a little script to replciate the issue: drop table j_test; CREATE TABLE J_TEST ( ID NUMBER(10) PRIMARY KEY, C1 VARCHAR2(50 BYTE), C2 VARCHAR2(250 BYTE), C3 NUMBER(5), C4 NUMBER(10) ); -- just insert a bunch of rows insert ...
There are several factors that could contribute to the performance discrepancy you're seeing in the update statement across different environments in your Oracle database. Here are some possible areas to investigate: 1. **Database Configuration and Resources**: - **Hardware Differences**: Different environments may...
41,939
[ { "from": "human", "value": "we're dealing with a very slow update statement in an Oracle project.\nHere's a little script to replciate the issue:\ndrop table j_test;\n\nCREATE TABLE J_TEST\n(\n ID NUMBER(10) PRIMARY KEY,\n C1 VARCHAR2(50 BYTE),\n C2 VARCHAR2(250 BYTE),\n C3 NUMBER(5),\n C4 NU...
I'm looking for tips, suggestions, advice or examples of applications build using Google's Web Toolkit with Google AppEngine.
Google Web Toolkit (GWT) is a framework for building complex web applications in Java and compiling them into JavaScript. When combined with Google App Engine (GAE), it allows developers to create scalable applications that leverage Google’s infrastructure. Here are some tips, suggestions, and examples to help you get ...
43,193
[ { "from": "human", "value": "I'm looking for tips, suggestions, advice or examples of applications build using Google's Web Toolkit with Google AppEngine.\n" }, { "from": "gpt", "value": "Google Web Toolkit (GWT) is a framework for building complex web applications in Java and compiling them int...
How can I add new application mapping in IIS using vbscript? Thanks,
To add a new application mapping in IIS (Internet Information Services) using VBScript, you can use the `IISAdmin` COM object to interact with the IIS settings. Below is a sample script that demonstrates how to add a new application mapping for a specific web application. This example assumes you're working with IIS 6....
40,264
[ { "from": "human", "value": "How can I add new application mapping in IIS using vbscript?\nThanks,\n" }, { "from": "gpt", "value": "To add a new application mapping in IIS (Internet Information Services) using VBScript, you can use the `IISAdmin` COM object to interact with the IIS settings. Bel...
I'm trying to create a css reset that targets only my control. So the HTML will look something like this: <body> <img class="outterImg" src="sadkitty.gif" /> <div id="container" class="container"> <img class="innerImg" src="sadkitty.gif" /> <div class="subContainer"> <img class="innerImg" src="sadkitt...
To effectively manage your CSS resets and specific styles within your control, you'll want to ensure that your selectors are correctly targeting the elements and that the specificity is appropriately set. Here's a breakdown of what you need to do. 1. **Global Styles**: You apply your initial styles to `img` as your ba...
45,791
[ { "from": "human", "value": "I'm trying to create a css reset that targets only my control. So the HTML will look something like this:\n<body>\n <img class=\"outterImg\" src=\"sadkitty.gif\" />\n <div id=\"container\" class=\"container\">\n <img class=\"innerImg\" src=\"sadkitty.gif\" />\n <div clas...
Other than pencil & paper? I found freemind, the mapping tool very useful. Any other ideas?
Certainly! There are many digital tools and methods for organizing your thoughts and ideas beyond pencil and paper. Here are some alternatives to consider: 1. **Mind Mapping Software**: - **XMind**: A versatile mind mapping tool that offers various templates and features. - **MindMeister**: A collaborative onlin...
45,639
[ { "from": "human", "value": "Other than pencil & paper?\nI found freemind, the mapping tool very useful. \nAny other ideas?\n" }, { "from": "gpt", "value": "Certainly! There are many digital tools and methods for organizing your thoughts and ideas beyond pencil and paper. Here are some alternati...
I am accessing a .NET COM object from C++. I want to know the version information about this COM object. When I open the TLB in OLEVIEW.exe I can see the version information associated with the coclass. How can I access this information from C++? This is the information I get: [ uuid(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX...
To access the version information of a COM object from C++, you generally interact with the type library (TLB) or the COM registry. The version information you are seeing in OLEVIEW is defined in the type library and may not be directly accessible in a straightforward manner through the COM interfaces. However, you can...
43,544
[ { "from": "human", "value": "I am accessing a .NET COM object from C++. I want to know the version information about this COM object. When I open the TLB in OLEVIEW.exe I can see the version information associated with the coclass. How can I access this information from C++? This is the information I get:\n...
I am looking for a solution to my problem. Is there a way to grab the value of the queue that a user assigns a case to on the case form. I would like to add the queue name to a custom attribute for further use during the save. I am using CRM 4 enterprise Thanks J
In Microsoft Dynamics CRM 4.0, you can use JavaScript to access form attributes and manipulate data when a case is being assigned to a queue. To achieve your goal of grabbing the value of the queue that a user assigns a case to and storing it in a custom attribute, you can follow these general steps: ### Step 1: Ident...
44,008
[ { "from": "human", "value": "I am looking for a solution to my problem. Is there a way to grab the value of the queue that a user assigns a case to on the case form. I would like to add the queue name to a custom attribute for further use during the save. I am using CRM 4 enterprise\nThanks\nJ\n" }, ...
As the question says, how do I set the value of a DropDownList control using jQuery?
To set the value of a DropDownList control using jQuery, you can use the `.val()` method. This method allows you to get or set the value of form elements. Here's how you can do it for a DropDownList (also known as a `<select>` element): ### Example HTML: ```html <select id="myDropDown"> <option value="1">Option 1<...
46,658
[ { "from": "human", "value": "As the question says, how do I set the value of a DropDownList control using jQuery?\n" }, { "from": "gpt", "value": "To set the value of a DropDownList control using jQuery, you can use the `.val()` method. This method allows you to get or set the value of form elem...
I have the following SQL query: select expr1, operator, expr2, count(*) as c from log_keyword_fulltext group by expr1, operator, expr2 order by c desc limit 2000; Problem: The count(*) as part of my order by is killing my application, probably because it don't use index. I would like to know if there is any way to ...
When dealing with performance issues in SQL queries, particularly with `GROUP BY` and `COUNT`, there are several strategies you might consider. Here are some recommendations that might help improve the performance of your query: ### 1. Optimize Indexing Ensure you have an appropriate index to support your query. Sinc...
44,053
[ { "from": "human", "value": "I have the following SQL query:\nselect expr1, operator, expr2, count(*) as c \nfrom log_keyword_fulltext \ngroup by expr1, operator, expr2 \norder by c desc limit 2000;\n\nProblem: The count(*) as part of my order by is killing my application, probably because it don't use inde...
I remember reading in some Java book about any operator other than 'instanceof' for comparing the type hierarchy between two objects. instanceof is the most used and common. I am not able to recall clearly whether there is indeed another way of doing that or not.
In Java, the primary way to check if an object is an instance of a certain class or subclass is indeed using the `instanceof` operator. However, there are a few other ways you might achieve similar functionality, although they are not as commonly used or straightforward as `instanceof`. Here are some alternatives: 1. ...
48,256
[ { "from": "human", "value": "I remember reading in some Java book about any operator other than 'instanceof' for comparing the type hierarchy between two objects.\ninstanceof is the most used and common. I am not able to recall clearly whether there is indeed another way of doing that or not.\n" }, { ...
I'm getting the error below when trying to loop through a listbox and then remove the item. List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change. foreach (string s in listBox1.Items) { MessageBox.Show(s); //do stuff with (s); listBox1.Items.Re...
The error you're encountering occurs because you're modifying the collection (`listBox1.Items`) while iterating over it using a `foreach` loop. When you remove an item, the enumerator becomes invalid since the collection has been altered. To avoid this, you can use a `for` loop to iterate through the items in reverse...
47,069
[ { "from": "human", "value": "I'm getting the error below when trying to loop through a listbox and then remove the item.\n\nList that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change.\n\nforeach (string s in listBox1.Items)\n{\n MessageBox.Show(s);...
I have a XML File like that <?xml version="1.0" encoding="utf-8" ?> <Configurations> <EmailConfiguration> <userName>xxxx</userName> <password>xxx</password> <displayName>xxxxx</displayName> <hostAddress>xxxx</hostAddress> ...
To read values from an XML file in C#, you can use `System.Xml.Linq` namespace, which provides an easy way to parse XML data. Below is an example of how to read the boolean values from your XML configuration and how to modify one of the values (e.g., setting `logEnable` to `false`). Here’s a complete example: 1. Firs...
44,806
[ { "from": "human", "value": "I have a XML File like that\n<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n\n <Configurations>\n\n <EmailConfiguration>\n <userName>xxxx</userName>\n <password>xxx</password>\n <displayName>xxxxx</displayName>\n ...
I am getting ready to start building a new web project in my spare time to bring to fruition an idea that has been bouncing around my head for a while. I have never gotten down whether I am better off first building the model and then the consuming application or the other way around. What are the best practices? What...
The question of whether to build the model or the consuming application first is a common consideration in software development. The choice often depends on various factors, including the complexity of the project, your personal workflow, and the specific technologies you’re using. Below are some best practices, advant...
41,208
[ { "from": "human", "value": "I am getting ready to start building a new web project in my spare time to bring to fruition an idea that has been bouncing around my head for a while.\nI have never gotten down whether I am better off first building the model and then the consuming application or the other way ...
I often find that I do a less than complete work on a feature, especially in the Design phase. I detect several reasons: I'm over-optimistic I feel the need to provide quick solutions, so sometimes I fool myself into thinking the design is fool-proof when in fact it's still full of holes, just to get the job done fast...
It's great that you're self-aware about this tendency, as recognizing the problem is the first step toward addressing it. Many people in creative and technical fields experience similar challenges, especially when faced with tight deadlines or the pressure to deliver results quickly. Here are some strategies that might...
47,855
[ { "from": "human", "value": "I often find that I do a less than complete work on a feature, especially in the Design phase. I detect several reasons:\n\nI'm over-optimistic\nI feel the need to provide quick solutions, so sometimes I fool myself into thinking the design is fool-proof when in fact it's still ...
MS SQL Server 2000 I have a column in Table A called Name. I wish to sort the Name field. Many but not all of the records for Name start will KL and are followed by a number (KL 1234, KL 2, KL 323, etc). Table A Name Able Bravo KL 2 KL 323 KL 1234 Zebra If I use Select Name from A Order by Name I get Able Bravo KL 12...
To achieve the desired sorting of your `Name` column, you can use a `CASE` statement in the `ORDER BY` clause to handle different scenarios based on whether the `Name` starts with "KL" or not. Here's how you can write the SQL query: ```sql SELECT Name FROM A ORDER BY CASE WHEN Name LIKE 'KL %' THEN CA...
47,575
[ { "from": "human", "value": "MS SQL Server 2000\nI have a column in Table A called Name. I wish to sort the Name field. Many but not all of the records for Name start will KL and are followed by a number (KL 1234, KL 2, KL 323, etc).\nTable A\nName\nAble\nBravo\nKL 2\nKL 323\nKL 1234\nZebra\nIf I use\nSelec...
I want to make a transparent dialog. I capture the OnCtlColor message in a CDialog derived class...this is the code: HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(bSetBkTransparent_) { pDC->SetBkMode(TRANSPARENT); hb...
Creating a transparent group box control (or static control) in a dialog can be tricky, especially in Windows XP where certain default controls have limitations regarding transparency. Given your experience, here are some additional insights and alternatives to achieve a transparent effect for a group box: ### Underst...
42,160
[ { "from": "human", "value": "I want to make a transparent dialog. I capture the OnCtlColor message in a CDialog derived class...this is the code:\nHBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) \n{\n HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);\n if(bSetBkTransparent_)\n ...
I have a table of transactions which will occasionally have duplicate entries. If/When an admin finds these duplicate entries, they will reverse the transactions, therefore creating a negative value (but the original duplicate still remains due to regulatory requirements). I'd like to create a SQL query (and use Cryst...
Certainly! You can achieve the desired result using SQL by grouping your transactions while excluding those that have been reversed. You will want to filter out the records where `Reversal = 'Y'` and count the duplicate transactions for those that remain. Here's an SQL query that will provide you with the desired outp...
46,851
[ { "from": "human", "value": "I have a table of transactions which will occasionally have\nduplicate entries. If/When an admin finds these duplicate entries, they will reverse the transactions, therefore creating a negative value (but the original duplicate still remains due to regulatory requirements). I'd...
Let's say we're tracking the end-user IP for a web service: ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") If ip = "" Then ip = Request.ServerVariables("REMOTE_ADDR") End If I've read that this is the best method of retrieving end-user IP because it works even for users on a transparent proxy. If we're using...
The approach you're using to retrieve the end-user's IP address is common in web applications, especially when dealing with users behind proxies. However, there are several security implications and considerations you should keep in mind when using `HTTP_X_FORWARDED_FOR` to filter malicious users. ### 1. **Trusting th...
45,429
[ { "from": "human", "value": "Let's say we're tracking the end-user IP for a web service:\nip = Request.ServerVariables(\"HTTP_X_FORWARDED_FOR\")\nIf ip = \"\" Then\n ip = Request.ServerVariables(\"REMOTE_ADDR\")\nEnd If\n\nI've read that this is the best method of retrieving end-user IP because it works ...
I have a question similar to the one here: Event handlers inside a Javascript loop - need a closure? but I'm using jQuery and the solution given seems to fire the event when it's bound rather than on click. Here's my code: for(var i in DisplayGlobals.Indicators) { var div = d.createElement("div"); div.style.wid...
The issue you're encountering arises from how closures work in JavaScript when you're using a loop. When you attach the click event handler, the values of `i` and `j` may have already changed by the time the event is triggered, leading to the behavior you're observing where `_this.Indicator.TrueImage` always gets the l...
44,146
[ { "from": "human", "value": "I have a question similar to the one here: Event handlers inside a Javascript loop - need a closure? but I'm using jQuery and the solution given seems to fire the event when it's bound rather than on click.\nHere's my code:\nfor(var i in DisplayGlobals.Indicators)\n{\n var di...