instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am having an unusual problem. I have always been able to drag files and folder from my desktop or explorer to the solution explorer in visual studio and add the files to my project. No when I attempt to drag files I simply get the "stop" symbol. I am using Visual Studio 2008 running on Vista Home Premium 64 bit. Any...
The issue you're experiencing with dragging files into the Solution Explorer in Visual Studio 2008 could be due to a few different reasons. Here are some troubleshooting steps you can try to resolve the problem: 1. **Check File Permissions**: - Ensure that the files you're trying to drag into Visual Studio are not ...
29,936
[ { "from": "human", "value": "I am having an unusual problem. I have always been able to drag files and folder from my desktop or explorer to the solution explorer in visual studio and add the files to my project. No when I attempt to drag files I simply get the \"stop\" symbol. \nI am using Visual Studio 20...
In my current logging class I log the browser, browser version and javascript version. The Javascript version I get through HttpContext.Request.Browser.JScriptVersion This works fine for IE, but not for any other browser. Is there another way (not javascript based) to detect the installed javascript version?
Detecting the JavaScript version installed on a user's browser is inherently challenging because different browsers implement JavaScript engines differently, and there is no standardized way to get the "version" of JavaScript that a browser supports without executing JavaScript code. The `HttpContext.Request.Browser.JS...
28,937
[ { "from": "human", "value": "In my current logging class I log the browser, browser version and javascript version.\nThe Javascript version I get through \nHttpContext.Request.Browser.JScriptVersion\n\nThis works fine for IE, but not for any other browser.\nIs there another way (not javascript based) to det...
Are there any good value list handler implementations available? I've found valuelist, but it seems to be stagnating... besides I really need good control of links the taglib generates, because I need to call some JavaScript from it. Currently I solve it by rewriting the taglib in freemarker and using valuelist's backe...
It sounds like you are looking for a way to implement a value list handler that allows for greater control over the output, particularly regarding the generated HTML links, while also integrating with a backend like the `valuelist` you mentioned. Here are some potential alternatives and suggestions you might consider:...
29,314
[ { "from": "human", "value": "Are there any good value list handler implementations available?\nI've found valuelist, but it seems to be stagnating... besides I really need good control of links the taglib generates, because I need to call some JavaScript from it.\nCurrently I solve it by rewriting the tagli...
Is there a way to map a logical font (e.g. SansSerif) to a different font when running a Java program? If so, does the method differ between Java VM versions?
Yes, in Java, you can map a logical font (like "SansSerif") to a different physical font by using the `GraphicsEnvironment` and `Graphics` classes. This method allows you to change the font that is displayed when a logical font is requested. To achieve this, you can create a custom font by using the `Font` class and t...
27,756
[ { "from": "human", "value": "Is there a way to map a logical font (e.g. SansSerif) to a different font when running a Java program? If so, does the method differ between Java VM versions?\n" }, { "from": "gpt", "value": "Yes, in Java, you can map a logical font (like \"SansSerif\") to a differen...
Some iPhone applications, such as Pandora seem to directly manipulate the hardware volume and respond to physical volume button. How is this done? AudioSessionServices allows you to get the current hardware output volume with the kAudioSessionProperty_CurrentHardwareOutputVolume property, but it is (allegedly) read-onl...
To manipulate hardware volume in iOS applications like Pandora, developers typically use the `MPVolumeView` class and related APIs from the Media Player framework. Here's a breakdown of how these applications manage volume: 1. **MPVolumeView**: This is a standard control that displays the system volume slider. By usin...
30,730
[ { "from": "human", "value": "Some iPhone applications, such as Pandora seem to directly manipulate the hardware volume and respond to physical volume button. How is this done?\nAudioSessionServices allows you to get the current hardware output volume with the kAudioSessionProperty_CurrentHardwareOutputVolum...
I came across this code and wanted others to provide their point of view... is it good or bad ? ;) Class ReportClass { public string ReportName {get; set;} } Then it was used as follows in code: displayReport(ReportClass.ReportName = cmbReportName.SelectedValue.ToString()) That is about the simplest form example I c...
The code you've shared contains several important concepts, but it also has some issues that can lead to confusion and unintended consequences. Let's break it down: ### The Code: ```csharp class ReportClass { public string ReportName { get; set; } } ``` ### Usage: ```csharp displayReport(ReportClass.ReportName ...
29,398
[ { "from": "human", "value": "I came across this code and wanted others to provide their point of view... is it good or bad ? ;)\nClass ReportClass\n{\n public string ReportName {get; set;}\n}\n\nThen it was used as follows in code:\ndisplayReport(ReportClass.ReportName = cmbReportName.SelectedValue.ToString...
I need to leave some instructional comments for other developers on a page/user control. Is there a better way to do this besides the below? <% /* DO NOT rename control IDs here, because blah blah blah... */ %>
Using comments in your code is a great way to provide context and instructions for other developers. However, inline comments within HTML or ASP.NET code can become cluttered and hard to read, especially if they are lengthy. Here are some alternative approaches for leaving instructional comments that can improve clarit...
30,781
[ { "from": "human", "value": "I need to leave some instructional comments for other developers on a page/user control. Is there a better way to do this besides the below?\n <% /* DO NOT rename control IDs here, because blah blah blah... */ %>\n\n" }, { "from": "gpt", "value": "Using comments in...
I have a dictionary where keys are strings, and values are integers. stats = {'a': 1, 'b': 3000, 'c': 0} How do I get the key with the maximum value? In this case, it is 'b'. Is there a nicer approach than using an intermediate list with reversed key-value tuples? inverse = [(value, key) for key, value in stats.items...
Yes, there is a more concise and efficient way to find the key with the maximum value in a dictionary without creating an intermediate list. You can use the `max()` function directly on the dictionary's items. Here's how you can do it: ```python stats = {'a': 1, 'b': 3000, 'c': 0} max_key = max(stats, key=stats.get) p...
33,820
[ { "from": "human", "value": "I have a dictionary where keys are strings, and values are integers.\nstats = {'a': 1, 'b': 3000, 'c': 0}\n\nHow do I get the key with the maximum value? In this case, it is 'b'.\n\nIs there a nicer approach than using an intermediate list with reversed key-value tuples?\ninvers...
I want to do something like this: create table app_users ( app_user_id smallint(6) not null auto_increment primary key, api_key char(36) not null default uuid() ); However this results in a error, is there a way to call a function for a default value in mysql? thanks.
In MySQL, you cannot directly use a function like `UUID()` as a default value for a column when creating a table. However, you can achieve the desired behavior using a `BEFORE INSERT` trigger. Here’s how you can create the table and the trigger to set the `api_key` to a UUID if it's not provided during the insert: 1....
29,827
[ { "from": "human", "value": "I want to do something like this:\n\n\ncreate table app_users\n(\n app_user_id smallint(6) not null auto_increment primary key,\n api_key char(36) not null default uuid()\n);\n\n\nHowever this results in a error, is there a way to call a function for a default value in...
After reading many of the replies to this thread, I see that many of those who dislike it cite the potential for abuse of the new keyword. My question is, what sort of abuse? How could this be abused so badly as to make people vehemently dislike it? Is it just about purism? Or is there a real pitfall that I'm just not ...
The concerns regarding the potential abuse of the `new` keyword can often stem from a variety of factors related to software design principles, maintainability, and readability of code. Here are a few key points that might shed light on why some developers are apprehensive about its usage: 1. **Complexity and Readabil...
26,664
[ { "from": "human", "value": "After reading many of the replies to this thread, I see that many of those who dislike it cite the potential for abuse of the new keyword. My question is, what sort of abuse? How could this be abused so badly as to make people vehemently dislike it? Is it just about purism? Or i...
Sharepoint Central Administration site uses the selector control I'm talking about a lot (for selecting site collections and web applications primarily) I have MOSS 2007 installed on a VM. When I open Central Administration from outside the VM from my desktop everything works fine. But when I open it from IE 6 install...
It sounds like you've already found a solution by upgrading to IE7, which is a great move since MOSS 2007 tends to work better with later versions of Internet Explorer. However, if you're interested in troubleshooting or understanding why the selector controls didn't function properly in IE6, here are a few points to c...
30,725
[ { "from": "human", "value": "Sharepoint Central Administration site uses the selector control I'm talking about a lot (for selecting site collections and web applications primarily)\n\nI have MOSS 2007 installed on a VM. When I open Central Administration from outside the VM from my desktop everything works...
Can anyone suggest me on what data structure to use for a soundex algorithm program? The language to be used is Java. If anybody has worked on this before in Java. The program should have these features: be able to read about 50,000 words should be able to read a word and return the related words having the same soun...
For implementing a Soundex algorithm program in Java that can efficiently handle the features you've described, here are a few data structures you can consider: 1. **HashMap**: - Use a `HashMap<String, List<String>>` where the key is the Soundex code and the value is a list of words that correspond to that code. T...
30,707
[ { "from": "human", "value": "Can anyone suggest me on what data structure to use for a soundex algorithm program? The language to be used is Java. If anybody has worked on this before in Java. The program should have these features:\n be able to read about 50,000 words\n should be able to read a word and re...
Someone left the organisation but before leaving, he locked all the files for an unknown reason. How do you unlock them all so that the other developers can work?
Unlocking files that have been locked by a user who has left the organization can be a delicate process, depending on the specific systems and software in use. Here are general steps to follow, which may need to be adapted to your specific environment: ### 1. Identify Locked Files - **Check for File Locks**: Determine...
28,477
[ { "from": "human", "value": "Someone left the organisation but before leaving, he locked all the files for an unknown reason. \nHow do you unlock them all so that the other developers can work?\n" }, { "from": "gpt", "value": "Unlocking files that have been locked by a user who has left the orga...
I need to set the onload attribute for a newly popped-up window. The following code works for Firefox: <a onclick="printwindow=window.open('www.google.com');printwindow.document.body.onload=self.print();return false;" href='www.google.com'> However, when I try this in IE, I get an error - "printwindow.document.body nu...
To accomplish your goal of opening a new window and triggering the print dialog in a way that works in both Firefox and Internet Explorer, you can modify your approach to wait for the new window to fully load before attempting to access its `document.body`. This is especially important in Internet Explorer, as it may n...
25,799
[ { "from": "human", "value": "I need to set the onload attribute for a newly popped-up window.\nThe following code works for Firefox:\n<a onclick=\"printwindow=window.open('www.google.com');printwindow.document.body.onload=self.print();return false;\" href='www.google.com'>\n\nHowever, when I try this in IE,...
I just downloaded the ASP.NET MVC beta and the templates are not StyleCop compliant. Why is new .NET code coming from Microsoft not StyleCop compliant?
The lack of StyleCop compliance in new ASP.NET MVC templates can be attributed to several factors: 1. **Shift in Style Guidelines**: Microsoft may have shifted its internal coding standards and style guidelines. They may have opted for a different set of conventions that do not fully align with StyleCop rules, focusin...
32,314
[ { "from": "human", "value": "I just downloaded the ASP.NET MVC beta and the templates are not StyleCop compliant. \nWhy is new .NET code coming from Microsoft not StyleCop compliant?\n" }, { "from": "gpt", "value": "The lack of StyleCop compliance in new ASP.NET MVC templates can be attributed ...
I am creating my application using Django, and am wondering how I can make Django use my CSS file? What settings do I need to do to make Django see the css file? NB: On a local machine
To use your CSS files in a Django application, you'll need to configure static files correctly. Here's a step-by-step guide to help you set this up, especially for development on your local machine. ### Step 1: Create a Directory for Static Files 1. **Create a directory** in your Django app where you will store your ...
28,016
[ { "from": "human", "value": "I am creating my application using Django, and am wondering how I can make Django use my CSS file? What settings do I need to do to make Django see the css file?\nNB: On a local machine\n" }, { "from": "gpt", "value": "To use your CSS files in a Django application, y...
Is there a built-in way to escape user input in java using the JDBC? Something similar to the php version mysql_real_escape() function. What's the best way to validate input?
In Java, when using JDBC (Java Database Connectivity) to interact with a database, you should not rely on escaping user input as a means of preventing SQL injection vulnerabilities. Instead, the best practice is to use **prepared statements**. Prepared statements automatically handle user input correctly by treating it...
28,737
[ { "from": "human", "value": "Is there a built-in way to escape user input in java using the JDBC? Something similar to the php version mysql_real_escape() function. What's the best way to validate input?\n" }, { "from": "gpt", "value": "In Java, when using JDBC (Java Database Connectivity) to in...
Clicking through to the download-page if see that the last version of the download is over one year old and it's also "just" a Release Candidate of version 1.0. There are really no news on any development. Yes, you can find newer versions from the nightly builds, but that's not a real serious option. Also, the "getting...
It sounds like you're referring to a software project that has not seen significant updates or progress in a while. When you encounter a release candidate (RC) that has been around for over a year without a stable release or significant new features, it can be concerning. Here are a few possible explanations for this s...
29,532
[ { "from": "human", "value": "Clicking through to the download-page if see that the last version of the download is over one year old and it's also \"just\" a Release Candidate of version 1.0. There are really no news on any development.\nYes, you can find newer versions from the nightly builds, but that's n...
Excel has a Conditional Formatting... option under the Format menu that allows you to change the style/color/font/whatever of a cell depending upon its value. But it only allows three conditions. How do I get Excel to display say, six different background cell colors depending upon the value of the cell? (IE Make the...
In Excel, while the built-in Conditional Formatting feature has a limit of three rules per formatting option in earlier versions, you can easily create multiple conditions using the "Conditional Formatting" feature and additional rules. Here's how to apply up to six different background colors based on cell values: ##...
29,128
[ { "from": "human", "value": "Excel has a Conditional Formatting... option under the Format menu that allows you to change the style/color/font/whatever of a cell depending upon its value. But it only allows three conditions.\nHow do I get Excel to display say, six different background cell colors depending...
At the moment I am working in a pretty big project and I have been been asked to refactor some old code. Most of the refactoring is setting apart a big class into smaller components and functions. I've searched and seen some other questions related with the topic but I am not very happy with the proposed options. The p...
Refactoring code in an environment like Visual Studio 2005 can be challenging, especially when looking for lightweight tools that won't slow down your system. While there are fewer options available for such an old version of Visual Studio, here are some suggestions that might help you with your refactoring task: 1. *...
31,844
[ { "from": "human", "value": "At the moment I am working in a pretty big project and I have been been asked to refactor some old code. Most of the refactoring is setting apart a big class into smaller components and functions.\nI've searched and seen some other questions related with the topic but I am not v...
My repositorycombobox is showing blank option on default. How do I make the option 1 of the combobox to be the default value. I want to make this repositorycombobox to act like dropdown with no edit function. But if I make it non editable the dropdown wont work. So how do I do it?
To set a default value for a `RepositoryComboBox` in a WinForms or WPF application, you generally need to make sure that your combo box has a selected item after populating its items. Here’s how to achieve this while also ensuring that the combo box behaves like a dropdown without edit functionality: ### Steps to Se...
29,217
[ { "from": "human", "value": "\nMy repositorycombobox is showing blank option on default. How do I make the option 1 of the combobox to be the default value. \nI want to make this repositorycombobox to act like dropdown with no edit function. But if I make it non editable the dropdown wont work. So how do I ...
I am planning to move my vmWare's Virtual Machines from a Windows host to a Linux host (Ubuntu). It is possible to run vmWare Server in a Linux host that does not have the graphical environment (does not have X)? I just wonder how the graphical setup of Windows/Linux guest work in this case. Thanks in advance for your ...
Yes, it is possible to run VMware Server on a Linux host without a graphical environment (i.e., in a headless setup). You can manage your VMware Virtual Machines (VMs) using the command line, which is particularly useful on servers that do not have a graphical user interface (GUI). Here's how you can achieve this: ##...
29,635
[ { "from": "human", "value": "I am planning to move my vmWare's Virtual Machines from a Windows host to a Linux host (Ubuntu). It is possible to run vmWare Server in a Linux host that does not have the graphical environment (does not have X)?\nI just wonder how the graphical setup of Windows/Linux guest work...
Am I safe in casting a C++ bool to a Windows API BOOL via this construct bool mybool = true; BOOL apiboolean = mybool ? TRUE : FALSE; I'd assume this is a yes because I don't see any obvious problems but I wanted to take a moment to ask only because this may be more subtle than it appears. Thanks to Dima for (gently)...
Yes, you are safe in casting a C++ `bool` to a Windows API `BOOL` using the construct you provided. Here's a breakdown of your code: ```cpp bool mybool = true; BOOL apiboolean = mybool ? TRUE : FALSE; ``` 1. **C++ `bool` Type**: In C++, the `bool` type can hold one of two values: `true` (1) or `false` (0). 2. **...
31,088
[ { "from": "human", "value": "Am I safe in casting a C++ bool to a Windows API BOOL via this construct\nbool mybool = true;\nBOOL apiboolean = mybool ? TRUE : FALSE;\n\nI'd assume this is a yes because I don't see any obvious problems but I wanted to take a moment to ask only because this may be more subtle ...
What is the prefered method for creating a byte array from an input stream? Here is my current solution with .NET 3.5. Stream s; byte[] b; using (BinaryReader br = new BinaryReader(s)) { b = br.ReadBytes((int)s.Length); } Is it still a better idea to read and write chunks of the stream?
The method you are using to read the entire stream into a byte array using `BinaryReader.ReadBytes` will work, but it may not be the most efficient, especially if the stream is large. This approach reads the entire stream in one go, which can lead to high memory usage or even exceptions if the stream is too large. A m...
30,981
[ { "from": "human", "value": "What is the prefered method for creating a byte array from an input stream? \nHere is my current solution with .NET 3.5. \nStream s;\nbyte[] b;\n\nusing (BinaryReader br = new BinaryReader(s))\n{\n b = br.ReadBytes((int)s.Length);\n}\n\nIs it still a better idea to read and w...
In a normal web app w/ login and secure data, what is an easy way to secure that data and prevent it from being seen by using the browser's back button, once a user logs out?
To secure a web application and prevent users from accessing sensitive data after logging out, especially through the browser's back button, you can implement the following strategies: 1. **Session Management**: - Use secure session management practices. Ensure that sessions are invalidated on logout. This can be d...
29,412
[ { "from": "human", "value": "In a normal web app w/ login and secure data, what is an easy way to secure that data and prevent it from being seen by using the browser's back button, once a user logs out? \n" }, { "from": "gpt", "value": "To secure a web application and prevent users from access...
I have a DTS package that drops a table then creates it and populates it but sometimes something happens and the package fails after the drop table. If it's rerun it fails cuz the table hasn't been created yet. Is there something like "if exists" for SQLServer 2000 like in MySQL? thanks.
In SQL Server 2000, there is no built-in `IF EXISTS` functionality for tables like in newer versions of SQL Server or MySQL. However, you can achieve similar behavior by using a conditional check with a `SELECT` statement to check for the existence of the table before dropping it. Here's how you can do it: ```sql IF ...
31,701
[ { "from": "human", "value": "I have a DTS package that drops a table then creates it and populates it but sometimes something happens and the package fails after the drop table. If it's rerun it fails cuz the table hasn't been created yet. \nIs there something like \"if exists\" for SQLServer 2000 like in...
Heres the link: DAMNIE6TOHELL As you can see if viewed in glorious 'IE6-o-color', the footer is shifting 1px over to the left. I'm struggling to find a fix for this, I've whittled it down to a bare minimum of HTML. Is it something to do with haslayout perhaps? Any help much appreciated.
It sounds like you're experiencing a layout issue in Internet Explorer 6, which is notorious for its quirks and bugs related to rendering. The footer shifting by 1px could indeed be related to the `hasLayout` property, which is a concept in older versions of Internet Explorer that affects how elements are rendered and ...
31,022
[ { "from": "human", "value": "Heres the link:\nDAMNIE6TOHELL\nAs you can see if viewed in glorious 'IE6-o-color', the footer is shifting 1px over to the left.\nI'm struggling to find a fix for this, I've whittled it down to a bare minimum of HTML.\nIs it something to do with haslayout perhaps? Any help much ...
How do I use Windows Vista's FOLDERID API in order to retrieve filepaths for "known folders" such as System or Windows? I've seen some APIs but I don't know how to import them properly. And yes, I know this is a very newbie question, but I spent a half hour googling and couldn't find the answer; I'd also appreciate a w...
To retrieve file paths for known folders in Windows using C#, you can indeed use the `System.Environment.GetFolderPath` method, which is a managed interface. This is a straightforward way to get paths for known folders, including the System folder or the Windows folder. Here's how you can use it: ```csharp using Syst...
29,998
[ { "from": "human", "value": "How do I use Windows Vista's FOLDERID API in order to retrieve filepaths for \"known folders\" such as System or Windows? I've seen some APIs but I don't know how to import them properly. And yes, I know this is a very newbie question, but I spent a half hour googling and couldn...
Are there real tangible differences or is it just a matter of taste?
Your question seems to be asking about differences in various contexts, but without specific subject matter, I'll provide a general perspective. In many cases, there are real tangible differences between products, experiences, or ideas, which can be measured or objectively evaluated. For example: 1. **Food and Drink...
33,357
[ { "from": "human", "value": "Are there real tangible differences or is it just a matter of taste?\n" }, { "from": "gpt", "value": "Your question seems to be asking about differences in various contexts, but without specific subject matter, I'll provide a general perspective. \n\nIn many cases, t...
Would the following SQL statement automatically create an index on Table1.Table1Column, or must one be explicitly created? Database engine is SQL Server 2000 CREATE TABLE [Table1] ( . . . CONSTRAINT [FK_Table1_Table2] FOREIGN KEY ( [Table1Column] ) REFERENCES ...
In SQL Server, when you create a foreign key constraint, it does not automatically create an index on the column(s) involved in the foreign key unless there is already an index in place on that column. For SQL Server 2000 specifically, you must create the index explicitly if you want to optimize performance on lookup...
33,734
[ { "from": "human", "value": "Would the following SQL statement automatically create an index on Table1.Table1Column, or must one be explicitly created?\nDatabase engine is SQL Server 2000\n CREATE TABLE [Table1] (\n. . .\n CONSTRAINT [FK_Table1_Table2] FOREIGN KEY \n (\n ...
I am in the process of setting up the wso2 php web services framework on my ubuntu 8.04 development server. However my webservice is failing. Looking into the wsf_client.log (custom log for the framework) file gives me the error in the question. I belive the error is returned from axis, but I have no idea how to fix it...
To troubleshoot the issue you're facing with the WSO2 PHP Web Services Framework and the related Axis error, you can follow these steps: 1. **Check the Logs**: - Look deeper into the `wsf_client.log` file for any specific error messages. The logs can provide more context about the failure, such as whether it’s a n...
30,125
[ { "from": "human", "value": "I am in the process of setting up the wso2 php web services framework on my ubuntu 8.04 development server.\nHowever my webservice is failing. Looking into the wsf_client.log (custom log for the framework) file gives me the error in the question.\nI belive the error is returned ...
How does one accomplish absolute positioning using XSL? I am working on a XSL transformation to FO to PDF for mailing letters and am trying to figure out how to absolutely position the fo:blocks containing the Return Address and Recipient Address so that they are displayed in the windows on the envelope. Anyone have...
To achieve absolute positioning of elements using XSL-FO, you'll want to utilize the `fo:marker` and `fo:retrieve-marker` elements for positioning specific blocks within your layout. Absolute positioning is typically done using the `position` property set to `absolute` on `fo:block` or `fo:external-graphic` elements. ...
25,521
[ { "from": "human", "value": "How does one accomplish absolute positioning using XSL? I am working on a XSL transformation to FO to PDF for mailing letters and am trying to figure out how to absolutely position the fo:blocks containing the Return Address and Recipient Address so that they are displayed in t...
I need to extract only the 2nd level part of the domain from request.servervariables("HTTP_HOST") what is the best way to do this?
To extract the 2nd level part of a domain from `request.servervariables("HTTP_HOST")` in a web application (often in ASP.NET), you can do this by splitting the host string based on the dot (`.`) character and then accessing the appropriate array index. Here's a simple example in C#: ```csharp string host = Request.Se...
28,341
[ { "from": "human", "value": "I need to extract only the 2nd level part of the domain from request.servervariables(\"HTTP_HOST\") what is the best way to do this?\n" }, { "from": "gpt", "value": "To extract the 2nd level part of a domain from `request.servervariables(\"HTTP_HOST\")` in a web appl...
I have a 4 side convex Polygon defined by 4 points in 2D, and I want to be able to generate random points inside it. If it really simplifies the problem, I can limit the polygon to a parallelogram, but a more general answer is preferred. Generating random points until one is inside the polygon wouldn't work because it'...
Generating random points inside a convex polygon can be efficiently accomplished using a few different methods. Here's a general approach along with a specific case for parallelograms: ### General Approach for a Convex Polygon 1. **Triangulation**: Divide the polygon into triangles. This can be done using a triangula...
28,307
[ { "from": "human", "value": "I have a 4 side convex Polygon defined by 4 points in 2D, and I want to be able to generate random points inside it.\nIf it really simplifies the problem, I can limit the polygon to a parallelogram, but a more general answer is preferred.\nGenerating random points until one is i...
Does a tool exist for dynamically altering running javascript in a browser? For example, to change the values of javascript variables during runtime.
Yes, there are several tools and methods available for dynamically altering running JavaScript in a browser. Here are some common approaches: 1. **Browser Developer Tools**: - All major web browsers (such as Chrome, Firefox, and Edge) come with built-in developer tools that allow you to inspect and manipulate Java...
27,137
[ { "from": "human", "value": "Does a tool exist for dynamically altering running javascript in a browser? For example, to change the values of javascript variables during runtime.\n" }, { "from": "gpt", "value": "Yes, there are several tools and methods available for dynamically altering running ...
I'm currently using the ActiveRecord-based session store for my Rails app and I have a background process which clears out inactive sessions every 30 minutes. I'd like to switch to Rails' new cookie-based session store but how do I set the expiry time of the session to 30 minutes, as opposed to the default 'at end of s...
To switch your Rails app from ActiveRecord-based session store to a cookie-based session store with a specific expiry time (in your case, 30 minutes), you'll need to configure the session store in your Rails application. Here's how you can do that: 1. **Update your Gemfile (if necessary):** If you're not already usin...
31,755
[ { "from": "human", "value": "I'm currently using the ActiveRecord-based session store for my Rails app and I have a background process which clears out inactive sessions every 30 minutes.\nI'd like to switch to Rails' new cookie-based session store but how do I set the expiry time of the session to 30 minut...
What combination of CSS or attributes are needed?
To provide a helpful response, I need more context about what you want to achieve with your CSS or attributes. CSS can be used for a variety of purposes, such as styling elements, layout design, animations, etc. Here are a few common scenarios along with the CSS attributes that might be needed: 1. **Centering an Elem...
29,340
[ { "from": "human", "value": "What combination of CSS or attributes are needed?\n" }, { "from": "gpt", "value": "To provide a helpful response, I need more context about what you want to achieve with your CSS or attributes. CSS can be used for a variety of purposes, such as styling elements, layo...
What would you use to perform a compliance testing of an HTTP proxy? I've seen two projects so far: Web Polygraph (the feedback I got from a coworker is mostly negative) Funkload
When it comes to compliance testing of an HTTP proxy, both Web Polygraph and Funkload are options, but they serve different purposes and come with their own strengths and weaknesses. Here’s a brief overview of each and some additional considerations to help you choose: ### Web Polygraph **Overview:** - Web Polygraph i...
28,549
[ { "from": "human", "value": "What would you use to perform a compliance testing of an HTTP proxy? I've seen two projects so far:\n\nWeb Polygraph (the feedback I got from a coworker is mostly negative)\nFunkload\n\n" }, { "from": "gpt", "value": "When it comes to compliance testing of an HTTP pr...
I have an XML file, and I want to find nodes that have duplicate CDATA. Are there any tools that exist that can help me do this? I'd be fine with a tool that does this generally for text documents.
Yes, there are several tools and methods that can help you find nodes with duplicate CDATA in an XML file. Here are some options: ### 1. **XPath and XSLT** You can use XPath queries to extract CDATA sections from your XML file, and then use XSLT to process those values and find duplicates. This would require some fami...
25,498
[ { "from": "human", "value": "I have an XML file, and I want to find nodes that have duplicate CDATA. Are there any tools that exist that can help me do this?\nI'd be fine with a tool that does this generally for text documents.\n" }, { "from": "gpt", "value": "Yes, there are several tools and me...
I've decided to add auto-update functionality to one of my applications and was looking for any existing solutions that compare the current running version with the latest version that is then downloaded from the web. I know Sparkle on Mac OSX which is very nice and powerful, but was wondering whether there is somethin...
For adding auto-update functionality to a Win32/MFC application, there are several options available that you can consider, similar to Sparkle for macOS: 1. **Squirrel.Windows**: - Squirrel is a popular open-source framework for Windows applications that provides auto-updating capabilities. It supports delta update...
26,961
[ { "from": "human", "value": "I've decided to add auto-update functionality to one of my applications and was looking for any existing solutions that compare the current running version with the latest version that is then downloaded from the web.\nI know Sparkle on Mac OSX which is very nice and powerful, b...
If I create a function with jQuery that adds an empty div, performs some animation inside the blank space created by the div, then removes the div, the browser never makes room for the empty div (height and width are set). If I don't remove the empty div in my function, then the browser will create the needed space and...
Yes, you can achieve the desired behavior by using a combination of jQuery's `animate()` method and the `callback` function that it accepts. This allows you to execute code after the animation is complete, while ensuring that the empty div is properly shown before it gets removed. Here's a basic example to illustrate ...
27,196
[ { "from": "human", "value": "If I create a function with jQuery that adds an empty div, performs some animation inside the blank space created by the div, then removes the div, the browser never makes room for the empty div (height and width are set).\nIf I don't remove the empty div in my function, then th...
I have an associative array in the form key => value where key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a count. This is fine for most instances, however I want a function that gets the human-readable name of the array and uses that for the ...
Yes, you can transform your associative array by creating a new array that uses human-readable names as keys while preserving the original values. You can do this efficiently using a simple loop or a mapping function. Below is an example of how you can achieve this in PHP: ### Example Code ```php function transformAr...
27,993
[ { "from": "human", "value": "I have an associative array in the form key => value where key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a count. This is fine for most instances, however I want a function that gets the human-readable...
If I change the WCF, do I have to run some sort of update on all client computers that are accessing the service? (i.e. run svutils.exe and update all app.config's etc?)
Yes, if you change the Windows Communication Foundation (WCF) service, you may need to update the client applications that consume this service. Here are some common scenarios where an update may be necessary: 1. **Service Contract Changes**: If you've modified the service contracts (interfaces) by adding, removing, o...
30,947
[ { "from": "human", "value": "If I change the WCF, do I have to run some sort of update on all client computers that are accessing the service? (i.e. run svutils.exe and update all app.config's etc?)\n" }, { "from": "gpt", "value": "Yes, if you change the Windows Communication Foundation (WCF) se...
The published code for Palm OS applications doesn't include standard headers, but instead uses Palm OS APIs for things like StrCopy and MemMove. Can I use standard headers and functions or do I need to convert my code to use the Palm OS versions?
When developing applications for Palm OS, it's important to adhere to the platform's conventions and APIs. While you might be tempted to use standard C libraries and headers, the typical practice for Palm OS development is to use its specific APIs, such as `StrCopy`, `MemMove`, and others. Here are a few reasons why y...
30,575
[ { "from": "human", "value": "The published code for Palm OS applications doesn't include standard headers, but instead uses Palm OS APIs for things like StrCopy and MemMove. Can I use standard headers and functions or do I need to convert my code to use the Palm OS versions?\n" }, { "from": "gpt", ...
My organization is starting to take SOA seriously but before we jump in one of the components we seem to be missing is a rock solid repository for tracking these services across the enterprise. Can anyone suggest a product that they have worked with? If the product is also an ESB please mention that in your answer.
When considering a repository for tracking services in a Service-Oriented Architecture (SOA) context, there are several products you might want to evaluate. Here are a few well-regarded options, some of which also offer Enterprise Service Bus (ESB) capabilities: 1. **MuleSoft Anypoint Platform**: - **Repository**: ...
28,201
[ { "from": "human", "value": "My organization is starting to take SOA seriously but before we jump in one of the components we seem to be missing is a rock solid repository for tracking these services across the enterprise. Can anyone suggest a product that they have worked with? If the product is also an ...
Is there an HTML color wheel that I can throw in my site that will return a value of the color when a user clicks on it? would make one myself but don't want to "re-invent the wheel" HILARIOUS(punny?)
Yes, there are several color picker libraries available that you can easily integrate into your website without having to reinvent the wheel! Here are a couple of popular options: ### 1. **HTML5 Color Picker (JavaScript)** You can use the built-in HTML5 `<input type="color">` element, which provides a simple color pic...
26,822
[ { "from": "human", "value": "Is there an HTML color wheel that I can throw in my site that will return a value of the color when a user clicks on it?\nwould make one myself but don't want to \"re-invent the wheel\"\nHILARIOUS(punny?)\n" }, { "from": "gpt", "value": "Yes, there are several color ...
Can someone tell me what the statuses mean in SQL Server's sp_who command? Why might a spid be suspended? What does it mean to be "runnable"? Thanks!
In SQL Server, the `sp_who` command is a system stored procedure that provides information about current users, sessions, and processes in the SQL Server database engine. The output of `sp_who` includes several columns, one of which is the `status` column. Here’s what some of the common statuses mean: ### Statuses 1....
30,428
[ { "from": "human", "value": "Can someone tell me what the statuses mean in SQL Server's sp_who command? Why might a spid be suspended? What does it mean to be \"runnable\"?\nThanks!\n" }, { "from": "gpt", "value": "In SQL Server, the `sp_who` command is a system stored procedure that provides ...
What's the better way to handle the ctrl + mouse wheel in C#? I've figured out how to handle the MouseWheel event but how to know that the ctrl key is being pressed too?
To handle the `Ctrl` + `Mouse Wheel` event in C#, you can use the `MouseWheel` event in combination with checking the state of the `Ctrl` key in your event handler. Here's a general approach to do this in a WinForms application. ### Step-by-step guide: 1. **Subscribe to the `MouseWheel` event** for the control (for e...
28,391
[ { "from": "human", "value": "What's the better way to handle the ctrl + mouse wheel in C#?\nI've figured out how to handle the MouseWheel event but how to know that the ctrl key is being pressed too?\n" }, { "from": "gpt", "value": "To handle the `Ctrl` + `Mouse Wheel` event in C#, you can use t...
I have a Ruby script that generates a UTF8 CSV file remotely in a Linux machine and then transfers the file to a Windows machine thru SFTP. I then need to open this file with Excel, but Excel doesn't get UTF8, so I always need to open the file in a text editor that has the capability to convert UTF8 to ANSI. I would l...
To convert a UTF-8 encoded CSV file to ANSI (typically Windows-1252 or ISO-8859-1) in Ruby, you can use the `String#encode` method to handle the conversion. You can read the UTF-8 file, convert its content, and then write it back out as a new ANSI-encoded file. Here's a simple example of how you can do this: ```ruby r...
29,528
[ { "from": "human", "value": "I have a Ruby script that generates a UTF8 CSV file remotely in a Linux machine and then transfers the file to a Windows machine thru SFTP. \nI then need to open this file with Excel, but Excel doesn't get UTF8, so I always need to open the file in a text editor that has the cap...
I need to search a string in the string array. I dont want to use any for looping in it string [] arr = {"One","Two","Three"}; string theString = "One" I need to check whether theString variable is present in arr.
If you want to check if a string is present in a string array without using a traditional for loop, you can use the built-in methods available in C#. One way to do this is by using the `Array.Exists` method or LINQ. Here are two examples: ### Using `Array.Exists`: ```csharp using System; class Program { static v...
33,096
[ { "from": "human", "value": "I need to search a string in the string array. I dont want to use any for looping in it\nstring [] arr = {\"One\",\"Two\",\"Three\"};\n\nstring theString = \"One\"\n\nI need to check whether theString variable is present in arr.\n" }, { "from": "gpt", "value": "If yo...
In JSP I can reference a bean's property by using the tag ${object.property} Is there some way to deal with properties that might not exist? I have a JSP page that needs to deal with different types. Example: public class Person { public String getName() } public class Employee extends Person { public float get...
In JSP, you can handle the situation where properties might not exist using the EL (Expression Language) and JSTL (JavaServer Pages Standard Tag Library). Specifically, you can use the `c:if` tag from JSTL to check if an object is of a certain type before accessing its properties. In your case, you can check if the `...
31,548
[ { "from": "human", "value": "In JSP I can reference a bean's property by using the tag\n${object.property}\nIs there some way to deal with properties that might not exist? I have a JSP page that needs to deal with different types. Example:\npublic class Person {\n public String getName()\n}\npublic class...
We have a sitemap for our site http://www.appsamuck.com/ The sitemap is here http://www.appsamuck.com/sitemap.xml But Google seems to hate it. My question is why? I'm just staring at it now saying to myself it looks right. Am I missing something? 3 Paths don't match We've detected that you submitted your Sitemap usin...
Based on the error message you're seeing, it seems that the issue is related to the inconsistency in the URL structure between the sitemap's location and the URLs listed within the sitemap. Here’s a breakdown of the problem and how you can resolve it: ### Problem Explanation - **Non-Matching Prefixes**: You submitted ...
21,858
[ { "from": "human", "value": "We have a sitemap for our site http://www.appsamuck.com/\nThe sitemap is here http://www.appsamuck.com/sitemap.xml\nBut Google seems to hate it. My question is why? I'm just staring at it now saying to myself it looks right. Am I missing something?\n3 Paths don't match\nWe've ...
The Oracle view V$OSSTAT holds a few operating statistics, including: IDLE_TICKS Number of hundredths of a second that a processor has been idle, totalled over all processors BUSY_TICKS Number of hundredths of a second that a processor has been busy executing user or kernel code, totalled over all processors The do...
The `V$OSSTAT` view in Oracle indeed provides statistics related to CPU usage, such as `IDLE_TICKS` and `BUSY_TICKS`. To address your questions: 1. **Resetting of `IDLE_TICKS` and `BUSY_TICKS`:** These statistics are cumulative and are not reset until the Oracle instance is restarted. They represent the total numbe...
32,016
[ { "from": "human", "value": "The Oracle view V$OSSTAT holds a few operating statistics, including:\n\nIDLE_TICKS Number of hundredths of a second that a processor has been idle, totalled over all processors\nBUSY_TICKS Number of hundredths of a second that a processor has been busy executing user or kerne...
This code always works, even in different browsers: function fooCheck() { alert(internalFoo()); // We are using internalFoo() here... return internalFoo(); // And here, even though it has not been defined... function internalFoo() { return true; } //...until here! } fooCheck(); I could not find a single refer...
The behavior you're observing in the `fooCheck` function is due to **JavaScript's function hoisting** feature. ### Understanding Hoisting In JavaScript, function declarations are hoisted to the top of their enclosing scope. This means that the entire function declaration is moved to the top of its scope during the co...
27,419
[ { "from": "human", "value": "This code always works, even in different browsers:\nfunction fooCheck() {\n alert(internalFoo()); // We are using internalFoo() here...\n\n return internalFoo(); // And here, even though it has not been defined...\n\n function internalFoo() { return true; } //...until here!\...
I have a really simple search form with the following Label ("Search") Textbox (fixed width) Submit button "Advanced" link Label, textbox and submit are all on one horizontal line and centered. Now I would like my advanced link to be under the submit button. Any ideas?
Certainly! To achieve the layout you described—where the label, textbox, and submit button are aligned on one horizontal line and the "Advanced" link is directly below the submit button—you can use HTML and CSS for styling. Here’s a simple example: ### HTML ```html <!DOCTYPE html> <html lang="en"> <head> <meta cha...
31,694
[ { "from": "human", "value": "I have a really simple search form with the following\n\nLabel (\"Search\")\nTextbox (fixed width)\nSubmit button\n\"Advanced\" link\n\nLabel, textbox and submit are all on one horizontal line and centered.\nNow I would like my advanced link to be under the submit button.\nAny i...
After "check-in" of a .docx file to SharePoint and editing it the RevNum property is set to 2. This does not make sense, can someone explain why this is?
In SharePoint, when you check in a document, the versioning system is designed to keep track of changes made to that document. The RevNum (Revision Number) property indicates the version of the document in the document library. When you initially upload a document to a SharePoint library, it is often considered versio...
31,219
[ { "from": "human", "value": "After \"check-in\" of a .docx file to SharePoint and editing it the RevNum property is set to 2.\nThis does not make sense, can someone explain why this is?\n" }, { "from": "gpt", "value": "In SharePoint, when you check in a document, the versioning system is designe...
In Perl, I can type: $|++; and anything printed to STDOUT will be automatically fflush()ed. Is there an equivalent in C? In other words, is there some way I can tell stdio to automatically fflush stdout after every printf(), the way it automatically flushes stderr?
In C, the standard output (`stdout`) is buffered, meaning that output may not appear immediately on the terminal. By default, it is line-buffered when connected to a terminal, which means it flushes the output buffer automatically when a newline character is encountered. However, if you want to ensure that output is fl...
30,643
[ { "from": "human", "value": "In Perl, I can type:\n$|++;\n\nand anything printed to STDOUT will be automatically fflush()ed.\nIs there an equivalent in C? In other words, is there some way I can tell stdio to automatically fflush stdout after every printf(), the way it automatically flushes stderr?\n" }, ...
I'm hitting this error and I'm not really sure why. I have a minified version of excanvas.js and something is breaking in IE, specifically on: var b=a.createStyleSheet(); I'm not sure why. Does anyone have any insight? I can provide more information, I'm just not sure what information will help.
The error you are encountering with `var b=a.createStyleSheet();` in `excanvas.js` suggests that the code is trying to create a new stylesheet in a context where it isn't allowed or fails to execute correctly. Here are some potential reasons and solutions to consider: 1. **Ensure Compatibility**: Make sure you are usi...
27,552
[ { "from": "human", "value": "I'm hitting this error and I'm not really sure why. I have a minified version of excanvas.js and something is breaking in IE, specifically on:\n\nvar b=a.createStyleSheet();\n\nI'm not sure why. Does anyone have any insight? I can provide more information, I'm just not sure w...
If I invoke a method which does something illegal, the debugger will stop at the line of code, in that method, which threw the exception If I use reflection to call a method via Invoke and that method throws an exception, the debugger stops on line where the method was called via reflection and not in the faulty metho...
When using reflection to invoke a method in C#, if that method throws an exception, the debugger typically stops at the line where the `Invoke` method is called instead of at the line within the called method where the exception originated. This can make debugging more challenging, as you may not immediately see where ...
29,572
[ { "from": "human", "value": "If I invoke a method which does something illegal, the debugger will stop at the line of code, in that method, which threw the exception\nIf I use reflection to call a method via Invoke and that method throws an exception, the debugger stops on line where the method was called ...
Closed as exact duplicate of "How can I find the method that called the current method?" Is this possible with c#? void main() { Hello(); } void Hello() { // how do you find out the caller is function 'main'? }
In C#, you can determine the caller of a method using the `System.Diagnostics.StackTrace` class. This allows you to inspect the call stack and retrieve information about the calling method. Here's how you can implement it: ```csharp using System; using System.Diagnostics; class Program { static void Main() { ...
32,852
[ { "from": "human", "value": "Closed as exact duplicate of \"How can I find the method that called the current method?\"\nIs this possible with c#?\nvoid main()\n{\n Hello();\n}\n\nvoid Hello()\n{\n // how do you find out the caller is function 'main'?\n}\n\n" }, { "from": "gpt", "value": "In ...
Does Eclipse have a feature that lets you search a project to find all calls to deprecated methods?
Yes, Eclipse has a feature that can help you find all calls to deprecated methods within a project. Here's how you can do it: 1. **Use the Search Functionality**: You can utilize the built-in search functionality in Eclipse. Here's how: - Open the **Search** menu (from the menu bar) and select **Java** > **Search.....
31,100
[ { "from": "human", "value": "Does Eclipse have a feature that lets you search a project to find all calls to deprecated methods?\n" }, { "from": "gpt", "value": "Yes, Eclipse has a feature that can help you find all calls to deprecated methods within a project. Here's how you can do it:\n\n1. **...
I have several identical elements with different attributes that I'm accessing with SimpleXML: <data> <seg id="A1"/> <seg id="A5"/> <seg id="A12"/> <seg id="A29"/> <seg id="A30"/> </data> I need to remove a specific seg element, with an id of "A12", how can I do this? I've tried looping through th...
In SimpleXML, using `unset()` on a loop variable does not remove the actual element from the SimpleXML object. Instead, you need to directly manipulate the SimpleXML structure to remove the desired node. You can achieve this by using the `DOM` extension to convert the SimpleXML object into a DOM document, allowing you...
31,144
[ { "from": "human", "value": "I have several identical elements with different attributes that I'm accessing with SimpleXML:\n<data>\n <seg id=\"A1\"/>\n <seg id=\"A5\"/>\n <seg id=\"A12\"/>\n <seg id=\"A29\"/>\n <seg id=\"A30\"/>\n</data>\n\nI need to remove a specific seg element, with an id...
We're currently running with php 5.2.5. We have now encountered a bug that creates a seg fault. Our first idea at the solution is upgrading to version 5.2.6 but are skeptical of problems that it will create. We are running Apache and host a dozen or so sites. Will any existing code break? Are there any significant cha...
Upgrading from PHP 5.2.5 to 5.2.6 is a relatively minor update, primarily consisting of bug fixes and security patches. Here are some points to consider based on your concerns: ### 1. Will any existing code break? - **Backward Compatibility**: Generally, minor version upgrades within the same major version (like movin...
27,841
[ { "from": "human", "value": "We're currently running with php 5.2.5. We have now encountered a bug that creates a seg fault. Our first idea at the solution is upgrading to version 5.2.6 but are skeptical of problems that it will create. We are running Apache and host a dozen or so sites.\n\nWill any existin...
The test driven development guys refer to a quick, exploratory, investigation that involves coding something up to see if it works, a spike. Any ideas why they came up with that word? Update: The coinage by Kent Beck looks like the 'original' one to me, although his usage of the word doesn't make much sense in my opini...
The term "spike" in the context of software development, especially in Agile methodologies and Test-Driven Development (TDD), refers to a time-limited research and exploration effort intended to investigate a technical question or gather knowledge. The idea is to "spike" into an area of uncertainty to gain insights tha...
33,222
[ { "from": "human", "value": "The test driven development guys refer to a quick, exploratory, investigation that involves coding something up to see if it works, a spike.\nAny ideas why they came up with that word?\nUpdate: The coinage by Kent Beck looks like the 'original' one to me, although his usage of t...
I'm inserting an img tag into my document with the new Element constructor like this (this works just fine): $('placeholder').insert(new Element("img", {id:'something', src:myImage})) I would like to trigger a function when this image loads, but I can't figure out the correct syntax. I'm guess it's something like this...
To attach an `onload` event directly in the `Element` constructor while creating an image element, you can use the `events` property to specify event handlers. Here's how you can do that: ```javascript $('placeholder').insert(new Element("img", { id: 'something', src: myImage, events: { load: funct...
33,672
[ { "from": "human", "value": "I'm inserting an img tag into my document with the new Element constructor like this (this works just fine):\n$('placeholder').insert(new Element(\"img\", {id:'something', src:myImage}))\n\nI would like to trigger a function when this image loads, but I can't figure out the corr...
I'm using Visual Studio icon library (VS2008ImageLibrary), there are some BMP files with a pink background. How can I make the pink background become transparent? What software can I use to do this? Any free one? Thanks
You can use several free software options to make the pink background of BMP files transparent. Here are a few popular choices: ### 1. **GIMP** GIMP (GNU Image Manipulation Program) is a powerful open-source image editor that allows you to easily make backgrounds transparent. **Steps to make pink background transpare...
28,259
[ { "from": "human", "value": "I'm using Visual Studio icon library (VS2008ImageLibrary), there are some BMP files with a pink background. How can I make the pink background become transparent? What software can I use to do this? Any free one? \nThanks\n" }, { "from": "gpt", "value": "You can use ...
When querying ntp servers with the command ntpdate, I can use the -u argument to make the source port an unrestricted port (port 1024 and above). With ntpd, which is meant to run in the background, I can't seem to find a way to turn this option on. So the source port is always 123. It's playing around horribly with my...
In `ntpd`, there isn't a direct configuration option in `ntp.conf` to specify that it should use a random source port for outgoing NTP packets. By default, `ntpd` uses the well-known NTP port (123), which is standard behavior and necessary for the protocol to work correctly. However, if you're having issues with firew...
28,417
[ { "from": "human", "value": "When querying ntp servers with the command ntpdate, I can use the -u argument to make the source port an unrestricted port (port 1024 and above).\nWith ntpd, which is meant to run in the background, I can't seem to find a way to turn this option on. So the source port is always ...
When I type the following code in Emacs ruby-mode, the "#{foo}" is fontified in a different color than the enclosing string. How do I do this in my own Emacs mode? I tried to decipher the ruby-mode source code but couldn't understand it in a reasonable amount of time. "a #{foo} a"
To achieve similar syntax highlighting behavior in your own Emacs mode, you'll need to create font-lock rules that match specific patterns within your strings. In the case of Ruby, the interpolation (e.g., `#{foo}`) is a special syntax that requires separate highlighting from the surrounding string. Here’s a step-by-s...
29,789
[ { "from": "human", "value": "When I type the following code in Emacs ruby-mode, the \"#{foo}\" is fontified in a different color than the enclosing string. How do I do this in my own Emacs mode? I tried to decipher the ruby-mode source code but couldn't understand it in a reasonable amount of time.\n\"a #...
Is there a Maven archetype that will generate the same scaffolding as maven-archetype-quickstart, but will in addition create the basic project site layout generated by maven-archetype-site? Or do I always have to run each in sequence?
As of my last knowledge update in October 2023, there isn't a single Maven archetype that combines the functionalities of both `maven-archetype-quickstart` (which creates a basic Java project structure) and `maven-archetype-site` (which sets up a project site layout) into one. Typically, you would follow these steps ...
30,904
[ { "from": "human", "value": "Is there a Maven archetype that will generate the same scaffolding as maven-archetype-quickstart, but will in addition create the basic project site layout generated by maven-archetype-site? Or do I always have to run each in sequence?\n" }, { "from": "gpt", "value":...
For example VK_LEFT, VK_DELETE, VK_ESCAPE, VK_RETURN, etc. How and where are they declared? Are they constants, #defines, or something else? Where do they come from? If possible, please provide a file name/path where they are declared. Or some other info as specific as possible.
The virtual key codes like `VK_LEFT`, `VK_DELETE`, `VK_ESCAPE`, `VK_RETURN`, and others are typically defined as constants in the Windows API. They are declared in the Windows header files, specifically in the `Winuser.h` file, which is part of the Windows SDK. ### Declaration and Definition - **Type**: They are defin...
28,462
[ { "from": "human", "value": "For example VK_LEFT, VK_DELETE, VK_ESCAPE, VK_RETURN, etc. How and where are they declared? Are they constants, #defines, or something else? Where do they come from?\nIf possible, please provide a file name/path where they are declared. Or some other info as specific as possible...
Can someone define what exactly 'POCO' means? I am encountering the term more and more often, and I'm wondering if it is only about plain classes or it means something more?
"POCO" stands for "Plain Old CLR Object." It's a term used primarily in the .NET ecosystem to describe simple objects that do not have any special behavior or features. The term is often employed in contrast to more complex objects that may be tied to a specific framework or library, which might introduce additional re...
33,419
[ { "from": "human", "value": "Can someone define what exactly 'POCO' means? I am encountering the term more and more often, and I'm wondering if it is only about plain classes or it means something more?\n" }, { "from": "gpt", "value": "\"POCO\" stands for \"Plain Old CLR Object.\" It's a term us...
This declaration causes an overflow in VBA: Const OVERFLOWS As Long = 10 * 60 * 60 whereas setting the value directly is fine: Const COMPILES_OK As Long = 36000 How do you persuade VBA to treat literal integers as longs? Thanks
In VBA, when performing arithmetic operations with literal integers, the default data type is `Integer`. Since `Integer` has a maximum value of 32,767, any operation that exceeds this value will cause an overflow. In your example, when you declare `Const OVERFLOWS As Long = 10 * 60 * 60`, VBA is performing the multipl...
27,411
[ { "from": "human", "value": "This declaration causes an overflow in VBA:\nConst OVERFLOWS As Long = 10 * 60 * 60\n\nwhereas setting the value directly is fine:\nConst COMPILES_OK As Long = 36000\n\nHow do you persuade VBA to treat literal integers as longs?\nThanks\n" }, { "from": "gpt", "value"...
I am trying to do something like this: while @nrOfAuthlevels >= @myAuthLevel begin set @myAuthLevel = @myAuthLevel + 1 SELECT Role.name, Role.authorityLevel FROM [dbo].[Role] ORDER BY Role.authorityLevel end The result of this stored procedure shall be a table with all Role.authorityLevel ...
To achieve your goal of returning a single table with all `Role.authorityLevel` below `@myAuthLevel`, you don't need to use a `WHILE` loop. Instead, you can directly query the `Role` table with a `WHERE` clause to filter the results based on the `@myAuthLevel`. Here's an example of how you can modify your stored proce...
28,817
[ { "from": "human", "value": "I am trying to do something like this:\nwhile @nrOfAuthlevels >= @myAuthLevel\nbegin\n set @myAuthLevel = @myAuthLevel + 1 \n SELECT Role.name, Role.authorityLevel\n FROM [dbo].[Role]\n ORDER BY Role.authorityLevel\nend\n\nThe result of this stored proced...
I have a system that uses a meta refresh to a logout page, which cleans up after idle users. (Don't worry, the server also times out the session) I started doing some operations via ajax (not really xml, but that's beside the point). I can run javascript returned from the async request, so I'm wondering if it's possi...
The `<meta http-equiv="refresh">` tag in HTML is used to automatically refresh or redirect the page after a specified amount of time. When the page is loaded, the browser reads this tag and schedules a refresh based on the specified time. If you want to change this timeout dynamically, you cannot directly replace the e...
30,924
[ { "from": "human", "value": "I have a system that uses a meta refresh to a logout page, which cleans up after idle users. (Don't worry, the server also times out the session)\nI started doing some operations via ajax (not really xml, but that's beside the point). I can run javascript returned from the asy...
Linux provides the stime(2) call to set the system time. However, while this will update the system's time, it does not set the BIOS hardware clock to match the new system time. Linux systems typically sync the hardware clock with the system time at shutdown and at periodic intervals. However, if the machine gets pow...
To ensure that the hardware clock (also known as the Real Time Clock or RTC) is updated when you set the system time in Linux, you can use the `hwclock` command after you set the system time. Here's how you can do it: 1. **Set the system time**: You can set the system time using the `date` command or the `stime()` sys...
31,118
[ { "from": "human", "value": "Linux provides the stime(2) call to set the system time. However, while this will update the system's time, it does not set the BIOS hardware clock to match the new system time.\nLinux systems typically sync the hardware clock with the system time at shutdown and at periodic in...
Is it possible to delete rows in an excel worksheet from SSIS?
Yes, it is possible to delete rows in an Excel worksheet from SQL Server Integration Services (SSIS). However, there are no built-in SSIS components that directly allow you to delete rows from an Excel file. You would typically need to use a combination of tools and techniques to achieve this. Here are a couple of meth...
25,039
[ { "from": "human", "value": "Is it possible to delete rows in an excel worksheet from SSIS?\n" }, { "from": "gpt", "value": "Yes, it is possible to delete rows in an Excel worksheet from SQL Server Integration Services (SSIS). However, there are no built-in SSIS components that directly allow yo...
I have a textbox with the Text property bound to a dataset column with the DataType set to System.DateTime. The FormatString on the Binding is set to dd-MM-yyyy. When the user enters a date it attempts to convert it to a date but can come up with some strange values for a seemingly invalid date. For example: textBox1.T...
To handle the validation of date input in a TextBox that's bound to a `DateTime` property in a dataset, you have a couple of approaches you can use. ### 1. Using Validating Event You can subscribe to the `Validating` event of the TextBox. In this event, you can implement custom validation logic to ensure that the dat...
29,207
[ { "from": "human", "value": "I have a textbox with the Text property bound to a dataset column with the DataType set to System.DateTime.\nThe FormatString on the Binding is set to dd-MM-yyyy.\nWhen the user enters a date it attempts to convert it to a date but can come up with some strange values for a seem...
I have a table "Blah" with a PK column BlahID and an XML column BlahItems in a database on SQL Server 2005. This table has records as follows... BlahID BlahItems ------ ------------------------------------------------------ 1 <root><item name="Fred" /><item name="Wilma" /></root> 2 <root><item name="Lisa" />...
To achieve the desired result of querying the `Blah` table and producing the expanded view with each item listed individually for each `BlahID`, you can use a CROSS APPLY in your SQL query to directly extract the XML values without needing to create a function. Here's how you can do it: ```sql SELECT b.BlahID, ...
31,930
[ { "from": "human", "value": "I have a table \"Blah\" with a PK column BlahID and an XML column BlahItems in a database on SQL Server 2005.\nThis table has records as follows...\n\nBlahID BlahItems\n------ ------------------------------------------------------\n1 <root><item name=\"Fred\" /><item name=\...
I'm wondering if its possible to add new class data members at run-time in PHP?
In PHP, you cannot add new class data members (also known as properties) to a class at runtime in the traditional sense. Class properties are defined at the time of class declaration. However, PHP does allow you to use certain techniques to achieve similar results. Here are a few approaches: ### 1. Using `stdClass` If...
30,143
[ { "from": "human", "value": "I'm wondering if its possible to add new class data members at run-time in PHP?\n" }, { "from": "gpt", "value": "In PHP, you cannot add new class data members (also known as properties) to a class at runtime in the traditional sense. Class properties are defined at t...
Using jquery how do I focus the first element (edit field, text area, dropdown field, etc) in the form when the page load? Something like: document.forms[0].elements[0].focus(); but using jquery. Another requirement, don't focus the first element when the form has class="filter".
You can achieve this using jQuery by selecting the form and its elements based on the specified requirements. Here's a simple script that focuses the first form element on page load, but only if the form does not have the class `filter`: ```javascript $(document).ready(function() { // Select the first form that do...
31,227
[ { "from": "human", "value": "Using jquery how do I focus the first element (edit field, text area, dropdown field, etc)\nin the form when the page load?\nSomething like:\ndocument.forms[0].elements[0].focus();\n\nbut using jquery.\nAnother requirement, don't focus the first element when the form has class=\...
I have a shared library that I wish to link an executable against using GCC. The shared library has a nonstandard name not of the form libNAME.so, so I can not use the usual -l option. (It happens to also be a Python extension, and so has no 'lib' prefix.) I am able to pass the path to the library file directly to the ...
Yes, you can link your executable against a shared library without hardcoding the full path to the library in the executable. To achieve this, you can use the `-Wl,-rpath` option with GCC to specify a runtime library search path. This way, you can provide the location of your shared library at runtime without embedding...
30,701
[ { "from": "human", "value": "I have a shared library that I wish to link an executable against using GCC. The shared library has a nonstandard name not of the form libNAME.so, so I can not use the usual -l option. (It happens to also be a Python extension, and so has no 'lib' prefix.)\nI am able to pass the...
What is the best way to check for the existence of a session variable in ASP.NET C#? I like to use String.IsNullOrEmpty() works for strings and wondered if there was a similar method for Session. Currently the only way I know of is: var session; if (Session["variable"] != null) { session = Session["variable"...
In ASP.NET, the `Session` object stores user-specific data across multiple requests. When you're checking for the existence of a session variable, the `Session` object can indeed be checked for `null`, but there are some more elegant ways to handle it, especially if you're trying to retrieve a string from the session. ...
24,186
[ { "from": "human", "value": "What is the best way to check for the existence of a session variable in ASP.NET C#? \nI like to use String.IsNullOrEmpty() works for strings and wondered if there was a similar method for Session. Currently the only way I know of is:\n var session;\n if (Session[\"variable\"]...
The string formatting concept found in sprintf can be found in almost any language today (you know, smothering a string with %s %d %f etc. and providing a list of variables to fill their places). Which langugage was it originally that had a library function or language construct which offered this functionality? Pleas...
The `sprintf` function, which allows for formatted string output using format specifiers like `%s`, `%d`, `%f`, etc., originated in the C programming language. The C Standard Library includes the `sprintf` function, which formats a string and stores it in a character array. The earliest versions of the C language were...
32,219
[ { "from": "human", "value": "The string formatting concept found in sprintf can be found in almost any language today (you know, smothering a string with %s %d %f etc. and providing a list of variables to fill their places). \nWhich langugage was it originally that had a library function or language constru...
I need a way to determine whether the computer running my program is joined to any domain. It doesn't matter what specific domain it is part of, just whether it is connected to anything. I'm coding in vc++ against the Win32 API.
To determine if a computer is joined to any domain using VC++ and the Win32 API, you can use the `NetJoinStatus` function from the Windows API, which helps you check the join status of the computer. Specifically, you can check if the computer is joined to a domain or a workgroup. Here's an example of how you can do th...
29,957
[ { "from": "human", "value": "I need a way to determine whether the computer running my program is joined to any domain. It doesn't matter what specific domain it is part of, just whether it is connected to anything. I'm coding in vc++ against the Win32 API.\n" }, { "from": "gpt", "value": "To de...
I would like the value of the input text box to be highlighted when it gains focus, either by clicking it or tabbing to it. <html> <body> <script> function focusTest(el) { el.select(); } </script> <input type="text" value="one" OnFocus="focusTest(this); return false;" /> <br/> <input type="text" value="two" OnFocu...
To ensure that the text input fields are highlighted when they gain focus in Safari (as well as in other browsers), you can modify your `focusTest` function to set the selection range of the input field. This modification is necessary because different browsers handle focus events differently. Here's an updated versio...
32,175
[ { "from": "human", "value": "I would like the value of the input text box to be highlighted when it gains focus, either by clicking it or tabbing to it.\n<html>\n<body>\n\n<script>\nfunction focusTest(el)\n{\n el.select();\n}\n</script>\n\n<input type=\"text\" value=\"one\" OnFocus=\"focusTest(this); retu...
I see little functional difference between using a property public readonly property foo as string get return bar end get end property or a function public function foo() as string return bar end function Why would I want to use one form over the other? Thanks!
The choice between using a property and a function in your code can depend on several factors, including clarity, intent, and usage patterns in your programming language. Here are some points to consider: ### Properties 1. **Intention**: Properties are typically used to represent an attribute of an object. Using a pr...
31,220
[ { "from": "human", "value": "I see little functional difference between using a property\npublic readonly property foo as string\n get\n return bar\n end get\nend property\n\nor a function\npublic function foo() as string\n return bar\nend function\n\nWhy would I want to use one form over the other?\n...
I have a largish Mercurial repository that I've decided would be better as several smaller repositories. Is there a way that I can split the repository and have each piece retain its revision history?
Yes, you can split a Mercurial repository into several smaller repositories while retaining the revision history for each piece. Here's a general outline of the steps you can take to accomplish this: ### Step 1: Prepare for the Split 1. **Backup Your Repository**: Before making any changes, create a backup of your exi...
28,623
[ { "from": "human", "value": "I have a largish Mercurial repository that I've decided would be better as several smaller repositories. Is there a way that I can split the repository and have each piece retain its revision history?\n" }, { "from": "gpt", "value": "Yes, you can split a Mercurial r...
What does the following mean? Class.Function(variable := 1 + 1) What is this operator called, and what does it do?
The expression `Class.Function(variable := 1 + 1)` uses the "walrus operator," which is denoted by `:=`. This operator was introduced in Python 3.8 and is also known as the "assignment expression" operator. It allows you to both assign a value to a variable and use that variable in an expression at the same time. In y...
33,495
[ { "from": "human", "value": "What does the following mean?\nClass.Function(variable := 1 + 1)\n\nWhat is this operator called, and what does it do? \n" }, { "from": "gpt", "value": "The expression `Class.Function(variable := 1 + 1)` uses the \"walrus operator,\" which is denoted by `:=`. This o...
I want to find a linux command that can return a part of the string. In most programming languages, it's the substr() function. Does bash have any command that can be used for this purpose. I want to be able to do something like this... substr "abcdefg" 2 3 - prints cde. Subsequent similar question: Extract substring...
In Bash, you can extract a substring using parameter expansion. The syntax for extracting a substring is: ```bash ${string:offset:length} ``` - `string` is the string variable you want to extract from. - `offset` is the starting position (zero-based index). - `length` is the number of characters to extract. Here's a...
30,155
[ { "from": "human", "value": "I want to find a linux command that can return a part of the string. In most programming languages, it's the substr() function. Does bash have any command that can be used for this purpose. I want to be able to do something like this...\nsubstr \"abcdefg\" 2 3 - prints cde.\n\nS...
In our administration team everyone has root passwords for all client servers. But what should we do if one of the team members is not longer working with us? He still has our passwords and we have to change them all, every time someone leave us. Now we are using ssh keys instead of passwords, but this is not helpful ...
Managing access to systems, especially sensitive ones, is crucial for maintaining security, especially when team members leave. Here are some strategies you can implement to enhance your security practices and reduce the need to change passwords frequently when someone departs: ### 1. **Implement Role-Based Access Con...
30,139
[ { "from": "human", "value": "In our administration team everyone has root passwords for all client servers.\nBut what should we do if one of the team members is not longer working with us?\nHe still has our passwords and we have to change them all, every time someone leave us. \nNow we are using ssh keys in...
Using the iPhone SDK is there a way to programmatically access (read/write) the ring tone that is assigned to a contact in the Address Book?
As of my last update, the iOS SDK does not provide a public API for accessing or modifying the ringtone assigned to a contact in the Address Book. Apple maintains strict privacy and security guidelines, and accessing or manipulating a contact's ringtone programmatically is not supported in their public frameworks. Dev...
34,551
[ { "from": "human", "value": "Using the iPhone SDK is there a way to programmatically access (read/write) the ring tone that is assigned to a contact in the Address Book?\n" }, { "from": "gpt", "value": "As of my last update, the iOS SDK does not provide a public API for accessing or modifying th...
There is another recent Project Euler question but I think this is a bit more specific (I'm only really interested in PHP based solutions) so I'm asking anyway. Question #5 tasks you with: "What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?" Now, I have solved it twice. Once very i...
To solve Project Euler's question #5 more efficiently in PHP, you can use the concept of the Least Common Multiple (LCM). The LCM of a set of numbers is the smallest number that is evenly divisible by all of them. The LCM of two numbers can be calculated using the greatest common divisor (GCD). The relationship is: \...
28,498
[ { "from": "human", "value": "There is another recent Project Euler question but I think this is a bit more specific (I'm only really interested in PHP based solutions) so I'm asking anyway.\nQuestion #5 tasks you with: \"What is the smallest number that is evenly divisible by all of the numbers from 1 to 20...
I'm trying to understand what this method means as I'm reading this and have wondered what uses this may have. I don't quite understand the example given. Can anyone give another explanation of it. Examples would help. Thanks
Of course! I’d be happy to help explain the method you’re referring to. However, I need a bit more context to provide a targeted explanation. Could you please share the name of the method or the topic you are reading about? Additionally, if you can include the example you mentioned or some details about it, that would ...
35,110
[ { "from": "human", "value": "I'm trying to understand what this method means as I'm reading this and have wondered what uses this may have. I don't quite understand the example given.\nCan anyone give another explanation of it. Examples would help.\nThanks\n" }, { "from": "gpt", "value": "Of cou...
Are Adobe's plugin architectures for Photoshop and Lightroom related in any way? If I have source code for a plugin, that works with PS 3.0-CS3 as well as PS Elements 6.0 can I use it with Lightroom directly? If not, what would I have to modify?
Adobe's plugin architectures for Photoshop and Lightroom are not directly compatible, as they were designed with different purposes and functionalities in mind. Photoshop plugins typically utilize the Adobe Photoshop SDK, which is tailored for Photoshop's complex image manipulation capabilities. These plugins often us...
30,943
[ { "from": "human", "value": "Are Adobe's plugin architectures for Photoshop and Lightroom related in any way? If I have source code for a plugin, that works with PS 3.0-CS3 as well as PS Elements 6.0 can I use it with Lightroom directly? If not, what would I have to modify?\n" }, { "from": "gpt", ...
Now that the G1 with Google's Android OS is now available (soon), will the android platform ever support .Net?
As of now, the Android platform primarily supports applications built using Java, Kotlin, and C++. However, there are ways to use .NET with Android through various frameworks and tools. One of the most notable is **Xamarin**, which allows developers to create cross-platform applications using C# and .NET. Xamarin appli...
31,521
[ { "from": "human", "value": "Now that the G1 with Google's Android OS is now available (soon), will the android platform ever support .Net?\n" }, { "from": "gpt", "value": "As of now, the Android platform primarily supports applications built using Java, Kotlin, and C++. However, there are ways ...
I'm working behind a proxy, and now I'm trying to mirror a remote subversion repository, then got could not connect to server error with the svn mirror command. I found the following on svk faq page: Currently svk doesn't have its own configuration file. however it loads the one that subversion uses, which should be ~...
If you are using TortoiseSVN and you don't see the `~/.subversion/servers` configuration file, you can create it manually. TortoiseSVN typically reads configuration settings from the same place as the command-line SVN client, which is stored in your user profile. Here’s how to set up the proxy configuration for Subver...
31,157
[ { "from": "human", "value": "I'm working behind a proxy, and now I'm trying to mirror a remote subversion repository, then got could not connect to server error with the svn mirror command.\nI found the following on svk faq page:\n\nCurrently svk doesn't have its own configuration file. however it loads the...
This web page http://www.w3schools.com/ASP/prop_sessionid.asp states that a session ID is generated on the ServerSide. If this is the case, then how does a server know it's still the same client on the 2nd request response cycle? Surely the SessionId would be generated on the ClientSide so that the client would be sur...
You're correct that a session ID is generated on the server side, but the way it is maintained across multiple requests from the client involves some client-side handling. Let me explain the process: 1. **Session Creation**: When a client (usually a web browser) makes a request to a server, the server generates a uniq...
32,375
[ { "from": "human", "value": "This web page http://www.w3schools.com/ASP/prop_sessionid.asp states that a session ID is generated on the ServerSide.\nIf this is the case, then how does a server know it's still the same client on the 2nd request response cycle? \nSurely the SessionId would be generated on the...
I was hoping someone could send me in the direction of a regularily updating time zone database. I have found one, but apologies i cant remember where it was from, however with the current GMT clock change fast approaching, i fear all my data will be incorrect, ie the differences from UK to New Yrok will change from 5 ...
Hello Cameron, For a regularly updating time zone database, you can consider the following options: 1. **IANA Time Zone Database**: This is one of the most widely used time zone databases, maintained by the Internet Assigned Numbers Authority (IANA). It is updated regularly to reflect changes in time zones. You can f...
28,811
[ { "from": "human", "value": "I was hoping someone could send me in the direction of a regularily updating time zone database.\nI have found one, but apologies i cant remember where it was from, however with the current GMT clock change fast approaching, i fear all my data will be incorrect, ie the differenc...
While I was investigating a problem I had with lexical closures in Javascript code, I came along this problem in Python: flist = [] for i in xrange(3): def func(x): return x * i flist.append(func) for f in flist: print f(2) Note that this example mindfully avoids lambda. It prints "4 4 4", which is surpr...
The behavior you observed in Python regarding the closure and variable scoping is due to how closures capture variables. In your original code: ```python flist = [] for i in xrange(3): def func(x): return x * i flist.append(func) for f in flist: print f(2) ``` When you define `func`, it closes over the...
31,711
[ { "from": "human", "value": "While I was investigating a problem I had with lexical closures in Javascript code, I came along this problem in Python:\nflist = []\n\nfor i in xrange(3):\n def func(x): return x * i\n flist.append(func)\n\nfor f in flist:\n print f(2)\n\nNote that this example mindful...
I'm trying to see if the user has pressed a decimal separator in a text box, and either allow or suppress it depending on other parameters. The NumberdecimalSeparator returns as 46, or '.' on my US system. Many other countries use ',' as the separator. The KeyDown event sets the KeyValue to 190 when I press the period....
To handle the decimal separator correctly in a way that respects the user's locale settings, it's important to avoid hardcoding specific characters like `.` or `,`. Instead, you should utilize the built-in localization functionality provided by .NET (or the framework you're working with) to determine the correct decima...
27,125
[ { "from": "human", "value": "I'm trying to see if the user has pressed a decimal separator in a text box, and either allow or suppress it depending on other parameters.\nThe NumberdecimalSeparator returns as 46, or '.' on my US system. Many other countries use ',' as the separator. The KeyDown event sets th...