instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
How can I simplify a basic arithmetic expression? e.g. module ExprOps where simplify :: Expr -> Expr simplify (Plus(Var"x") (Const 0)) = Var "x" What do I have to do? module Expr where -- Variables are named by strings, assumed to be identifiers. type Variable = String -- Representation of expressions. data Expr ...
To achieve simplification of arithmetic expressions as described, you will need to expand your `simplify` function to handle different cases, including simplifications involving constants, variables, and the arithmetic operations defined in your `Expr` data type. Below is a complete implementation of the `simplify` fu...
38,617
[ { "from": "human", "value": "How can I simplify a basic arithmetic expression?\ne.g.\nmodule ExprOps where \n\nsimplify :: Expr -> Expr\nsimplify (Plus(Var\"x\") (Const 0)) = Var \"x\"\n\nWhat do I have to do?\n\nmodule Expr where\n\n-- Variables are named by strings, assumed to be identifiers.\ntype Variab...
So, from my experience, masterpages sometimes can lag when you do updates. This is not a new occurance, you make a change, you build, you go to test and the MasterPage is still looking for the old control. Anyone have any tips/tricks they use when this happens? Usually it goes away after a while, but I don't have a wh...
Issues with master pages not updating correctly in ASP.NET can be frustrating. Here are several tips and tricks you can try to resolve the issue more quickly when working in Visual Studio 2008: 1. **Clean and Rebuild the Solution**: - Go to the menu and select `Build > Clean Solution`, then `Build > Rebuild Soluti...
39,742
[ { "from": "human", "value": "So, from my experience, masterpages sometimes can lag when you do updates. This is not a new occurance, you make a change, you build, you go to test and the MasterPage is still looking for the old control. \nAnyone have any tips/tricks they use when this happens? Usually it goes...
The company I work for uses an ASP.NET grid component from a commercial vendor, but won't upgrade the buggy old version we have to a newer version because of cost. Are there open-source alternatives to these Uber-Grids that we could take advantage of? I'm specifically looking for hierarchical drill-down capabilities....
There are several open-source alternatives to commercial ASP.NET grid components that provide hierarchical drill-down capabilities. Here are some options you can consider that fit within a server-side context: ### 1. **ASP.NET GridView with Hierarchical Data** - While not a specific library, you can utilize the bui...
40,190
[ { "from": "human", "value": "The company I work for uses an ASP.NET grid component from a commercial vendor, but won't upgrade the buggy old version we have to a newer version because of cost. Are there open-source alternatives to these Uber-Grids that we could take advantage of? \nI'm specifically looking...
What is a good method of writing reports using PHP and SQL Server? Is there a third party vendor that supports SQL Server?
Creating reports using PHP and SQL Server can be done effectively through various approaches and tools. Here’s a breakdown of a good method for writing reports, along with some third-party vendor options that support SQL Server: ### 1. **Setting Up Your Environment** - **Install PHP**: Ensure you have PHP installed on...
38,981
[ { "from": "human", "value": "What is a good method of writing reports using PHP and SQL Server? Is there a third party vendor that supports SQL Server?\n" }, { "from": "gpt", "value": "Creating reports using PHP and SQL Server can be done effectively through various approaches and tools. Here’s ...
I find the .Net FileSystemWatcher class really handy for writing utilities that automatically come to life when files show up in their watched folders. Is there any equivalent to this functionality in the *nix world that would allow me to watch a folder (and possibly all of its subdirectories)? Edit: Preferably this wi...
Yes, in the Unix/Linux world, you can achieve similar functionality to .NET's `FileSystemWatcher` using the `inotify` subsystem, which is a part of the Linux kernel. While `inotify` itself is a kernel feature, there are user-space libraries and tools that provide a higher-level interface to it, allowing you to monitor ...
39,139
[ { "from": "human", "value": "I find the .Net FileSystemWatcher class really handy for writing utilities that automatically come to life when files show up in their watched folders. Is there any equivalent to this functionality in the *nix world that would allow me to watch a folder (and possibly all of its ...
Is there a way in MySQL to select rows which fall on a specific day, as in Mondays, using a date column?
Yes, you can select rows that fall on a specific day of the week, such as Mondays, using a date column in MySQL. You can achieve this by using the `DAYOFWEEK()` function, which returns the day of the week for a given date. In MySQL, `DAYOFWEEK()` returns 1 for Sunday, 2 for Monday, and so on up to 7 for Saturday. To s...
42,279
[ { "from": "human", "value": "Is there a way in MySQL to select rows which fall on a specific day, as in Mondays, using a date column?\n" }, { "from": "gpt", "value": "Yes, you can select rows that fall on a specific day of the week, such as Mondays, using a date column in MySQL. You can achieve ...
When the view property of a UIViewController is accessed, it first checks to see if it's got an existing view, and returns that. If not, it loads its nib or calls -loadView. When a controller receives a -didReceiveMemoryWarning message, the default behavior is to remove that cached view (assuming it's not in use at th...
In `UIViewController`, the view is lazily loaded the first time you access `self.view`. Because of this lazy loading mechanism, you're right that accessing `self.view` in your overridden `-didReceiveMemoryWarning` method could inadvertently create the view if it doesn't already exist. To determine if the view has been...
40,898
[ { "from": "human", "value": "When the view property of a UIViewController is accessed, it first checks to see if it's got an existing view, and returns that. If not, it loads its nib or calls -loadView. \nWhen a controller receives a -didReceiveMemoryWarning message, the default behavior is to remove that c...
I have a computer at home which I can't access from work. I'd like to be able to view results from work that my home computer produces. The best idea I've come up with is an automated script running on my home computer that emails myself the results (from a text file or stderr/out) when complete. I'm decent with ba...
Sure, I can help outline the basic steps for automating the process of sending results from your home computer to your email. Below is a structured approach to solve your problem using a bash script, which can easily execute your commands and email results. ### Overview of the Steps 1. **Script Preparation**: Create ...
29,683
[ { "from": "human", "value": "I have a computer at home which I can't access from work. I'd like to be able to view results from work that my home computer produces. The best idea I've come up with is an automated script running on my home computer that emails myself the results (from a text file or stderr...
I am trying to setup Weblogic Server 10.3 (and Portal etc.) to use maven as a build tool. I am trying to find a decent tutorial or documentation how to do this. There are some tutorials for older versions like 9.0, but there is little info for version 10. I am looking a way to build weblogic's ear file with maven. Are ...
Using Maven to build a WebLogic Server application (including EAR files) is a common approach, especially when you're looking for better integration with Continuous Integration tools. Although WebLogic 10.3 is an older version, it is still possible to set up a Maven build for it. Here’s a guide to help you get started....
38,318
[ { "from": "human", "value": "I am trying to setup Weblogic Server 10.3 (and Portal etc.) to use maven as a build tool. I am trying to find a decent tutorial or documentation how to do this. There are some tutorials for older versions like 9.0, but there is little info for version 10.\nI am looking a way to ...
Do I need a UUID to program for the iPhone? I was told I need this, how can I get a UUID
Yes, you do need a UUID (Universally Unique Identifier) to develop and test apps on an actual iPhone. The UUID is used to uniquely identify your device in Apple's development environment, particularly when you are using Xcode for iOS app development. Here’s how to find your iPhone's UUID: 1. **Using Xcode**: - Con...
41,500
[ { "from": "human", "value": "Do I need a UUID to program for the iPhone? I was told I need this, how can I get a UUID\n" }, { "from": "gpt", "value": "Yes, you do need a UUID (Universally Unique Identifier) to develop and test apps on an actual iPhone. The UUID is used to uniquely identify your ...
I am trying to declare and use a class B inside of a class A and define B outside A. I know for a fact that this is possible because Bjarne Stroustrup uses this in his book "The C++ programming language" (page 293,for example the String and Srep classes). So this is my minimal piece of code that causes problems class A...
The issue you're encountering arises from the fact that in your constructor for `A`, you're attempting to dereference a pointer to the class `B` without having fully defined what `B` is at that point in time. Although you've forward-declared `B`, the definition of its members (like `i`) is not visible yet inside the co...
36,953
[ { "from": "human", "value": "I am trying to declare and use a class B inside of a class A\nand define B outside A.\nI know for a fact that this is possible because Bjarne Stroustrup\nuses this in his book \"The C++ programming language\"\n(page 293,for example the String and Srep classes).\nSo this is my mi...
How can I display something over all other application. I want to to display something over all form of my program and all other programs open on my desktop (not mine). *Top Most doesn't work I have tested and my browser can go OVER my application :S Here is an image of when I use TopMost to TRUE. You can see my browse...
To create a window that remains on top of all other applications, including browsers, you'll need to use certain techniques that vary depending on the programming language and framework you're using. Below, I’ll provide a solution for a Windows application using C#. If you're using a different programming environment, ...
39,556
[ { "from": "human", "value": "How can I display something over all other application. I want to to display something over all form of my program and all other programs open on my desktop (not mine).\n*Top Most doesn't work I have tested and my browser can go OVER my application :S\nHere is an image of when I...
I have a new project which simply put, is an attempt to formalize the look and feel of all of our departmental pages. I Googled around and found many tutorials which discussed the pros and cons of several techniques. And from what I've been reading, the thing I'm ooking for is controls. Basically, I want a common heade...
Yes, there are definitely more efficient ways to implement a common header and footer for your departmental pages without needing to copy a template each time. Here are some approaches you can consider: ### 1. Server-Side Includes (SSI) If your server supports SSI, you can create separate HTML files for your header an...
39,638
[ { "from": "human", "value": "I have a new project which simply put, is an attempt to formalize the look and feel of all of our departmental pages. I Googled around and found many tutorials which discussed the pros and cons of several techniques. And from what I've been reading, the thing I'm ooking for is c...
How to get file name and revision number as a list starting from a designated folder?
To get the file names and revision numbers as a list starting from a designated folder, you can use a programming language like Python along with libraries such as `os` and `subprocess`, depending on how you're tracking revisions (for example, using a version control system like Git or SVN). Here's a basic example us...
38,835
[ { "from": "human", "value": "How to get file name and revision number as a list starting from a designated folder?\n" }, { "from": "gpt", "value": "To get the file names and revision numbers as a list starting from a designated folder, you can use a programming language like Python along with li...
i have a windows client and i want to upgrade subversion from 1.5.3 to 1.5.4. are there installation steps. . do i just copy the zip and extract and override the existing directoies .. i can't find any clear upgrade instructions . .
Upgrading Subversion (SVN) on a Windows client from version 1.5.3 to 1.5.4 can typically be done by following a few straightforward steps. However, it is recommended to perform the upgrade carefully to avoid any issues. Here’s a general approach you can take: ### Backup Your Current Setup 1. **Backup Your Data**: Befo...
37,882
[ { "from": "human", "value": "i have a windows client and i want to upgrade subversion from 1.5.3 to 1.5.4. are there installation steps. . do i just copy the zip and extract and override the existing directoies .. i can't find any clear upgrade instructions . . \n" }, { "from": "gpt", "value":...
I'm looking for a good algorithm that can give me the unique edges from a set of polygon data. In this case, the polygons are defined by two arrays. One array is the number of points per polygon, and the other array is a list of vertex indices. I have a version that is working, but performance gets slow when reaching o...
To efficiently find unique edges from a large set of polygons, especially triangles and quads, you can use a hash map (or unordered map) to keep track of edges instead of using an `std::set`. This approach avoids the overhead of sorting and will improve performance significantly when dealing with a large number of poly...
34,375
[ { "from": "human", "value": "I'm looking for a good algorithm that can give me the unique edges from a set of polygon data. In this case, the polygons are defined by two arrays. One array is the number of points per polygon, and the other array is a list of vertex indices.\nI have a version that is working,...
A puzzler from a coworker that I cannot figure out... update btd.dbo.tblpayroll set empname = ( select b.Legal_Name from ( SELECT Legal_Name, Employee_ID FROM Com.dbo.Workers WHERE ...
The error message you're encountering, "Conversion failed when converting the varchar value 'N0007 ' to data type int," suggests that there is an issue with data type conversion somewhere in your query, specifically when it is trying to compare or assign values. From your description, it sounds like `empnum` is o...
40,292
[ { "from": "human", "value": "A puzzler from a coworker that I cannot figure out...\nupdate btd.dbo.tblpayroll\nset empname = ( select b.Legal_Name\n from ( SELECT Legal_Name,\n Employee_ID\n FROM Com.dbo....
I have a project where multiple developers are using a copy of the same windows Virtual PC image (W2K3 SE SP2). Because our solution is tied to the machine-name (less than ideal, i know) all of the developers have the same machine name. We use a VPN to connect to a remote system, upon connection we get the "Windows Er...
Using the same machine name across multiple instances in a network can lead to several issues, especially when those machines try to connect to a VPN or communicate with other devices over the network. Here are some reasons why it is a best practice to have unique machine names, along with potential impacts of not doin...
38,370
[ { "from": "human", "value": "I have a project where multiple developers are using a copy of the same windows Virtual PC image (W2K3 SE SP2). Because our solution is tied to the machine-name (less than ideal, i know) all of the developers have the same machine name.\nWe use a VPN to connect to a remote syst...
I haven't really looked into the new .NET stuff since 2.0, but I'm wondering what the preffered way is for creating Web Services is now (SOAP, not RESTful). I remember in the old days, you created a ASP.NET Web Service. Now, I've been looking at WCF, but it seems like there's some added complexity. I've GOOGLED for...
As of the later versions of .NET, especially after the introduction of WCF (Windows Communication Foundation) in .NET Framework 3.0, WCF has become the preferred way to create SOAP-based web services. It provides a more flexible and robust framework than the older ASP.NET Web Services (ASMX) approach. Here's a quick b...
39,658
[ { "from": "human", "value": "I haven't really looked into the new .NET stuff since 2.0, but I'm wondering what the preffered way is for creating Web Services is now (SOAP, not RESTful). I remember in the old days, you created a ASP.NET Web Service. Now, I've been looking at WCF, but it seems like there's ...
I've inherited a BizTalk 2006 application that uses several SOAP ports to request data from a 3rd party web service. The web service is secured by "basic" authentication - username / password. After making a few enhancements to the application I deployed to an integration test server which has access to the 3rd party w...
The issue you're encountering with the BizTalk 2006 SOAP send ports and the password not being set correctly through the binding file is a known limitation when it comes to deploying secured bindings in BizTalk. When the password is set to `NULL` in the binding file, it doesn’t translate well when you import the bindin...
38,683
[ { "from": "human", "value": "I've inherited a BizTalk 2006 application that uses several SOAP ports to request data from a 3rd party web service. The web service is secured by \"basic\" authentication - username / password. After making a few enhancements to the application I deployed to an integration test...
I am developing a touch screen application that has to display a possibly large amount of text. The problem I am having is that the default scroll bar attached to text boxes is just too small to be practically used in a touch screen application. I have tried adding a separate scroll bar control and using it to control ...
You're on the right track by trying to implement a custom scrolling solution for a touch screen application. Given the limitations and challenges you've faced with the default text box scrolling behavior and the scrolling APIs, let's consider a more manageable approach that maintains a smooth and responsive scrolling e...
39,520
[ { "from": "human", "value": "I am developing a touch screen application that has to display a possibly large amount of text. The problem I am having is that the default scroll bar attached to text boxes is just too small to be practically used in a touch screen application. I have tried adding a separate sc...
I typically use extension methods very sparingly. When I do feel compelled to write an extension method, I sometimes want to overload the method. My question is, what are your thoughts on extension methods calling other extension methods? Bad practice? It feels wrong, but I can't really define why. For example, the sec...
Your intuition about extending extension methods is spot on. While it's not inherently bad practice for one extension method to call another, there are a few considerations to keep in mind: ### Pros of Calling Extension Methods from Another Extension Method 1. **DRY Principle**: As you noted, it adheres to the Don't R...
41,304
[ { "from": "human", "value": "I typically use extension methods very sparingly. When I do feel compelled to write an extension method, I sometimes want to overload the method. My question is, what are your thoughts on extension methods calling other extension methods? Bad practice? It feels wrong, but I can'...
Here is a command on free bsd sudo pw usermod ksbuild -s /usr/local/bin/bash how do I do the equivalent on RHEL?
On Red Hat Enterprise Linux (RHEL), you can achieve the equivalent of the FreeBSD command you provided by using the `usermod` command. The `usermod` command in Linux is used to modify a user's account details. The command you want to execute is to change the shell of the user `ksbuild` to `/usr/local/bin/bash`. Here’...
43,218
[ { "from": "human", "value": "Here is a command on free bsd\nsudo pw usermod ksbuild -s /usr/local/bin/bash\n\nhow do I do the equivalent on RHEL?\n" }, { "from": "gpt", "value": "On Red Hat Enterprise Linux (RHEL), you can achieve the equivalent of the FreeBSD command you provided by using the `...
This might of been asked elsewhere (seems like a useful topic) but searches turned up nothing. One feature I love in Eclipse when programming Java is that I don't have to worry about putting in the import statements and any missed functions from interfaces that I am implementing them - if I do miss them a simple click ...
Visual Studio (including Visual Studio 2008) offers some features that can help automate the process of adding using directives (import statements) and implementing interface members, similar to what you've experienced in Eclipse. Here are some features you can use in Visual Studio 2008: 1. **Using Directive Generatio...
40,860
[ { "from": "human", "value": "This might of been asked elsewhere (seems like a useful topic) but searches turned up nothing.\nOne feature I love in Eclipse when programming Java is that I don't have to worry about putting in the import statements and any missed functions from interfaces that I am implementin...
If I have a range of say 000080-0007FF and I want to see if a char containing hex is within that range, how can I do it? Example char t = 0xd790; if (t is within range of 000080-0007FF) // true
To determine if a character (or a byte) containing a hexadecimal value is within a specific range, you need to compare its value against the start and end of the range. In your case, you want to check if the character `t` with a value of `0xd790` is within the range of `0x000080` and `0x0007FF`. Here is how you can pe...
41,458
[ { "from": "human", "value": "If I have a range of say 000080-0007FF\nand I want to see if a char containing hex is within that range, how can I do it?\nExample\nchar t = 0xd790;\n\nif (t is within range of 000080-0007FF) // true\n\n" }, { "from": "gpt", "value": "To determine if a character (or ...
Is there a good tool to compare specifically web.config files to find specifically which settings are different values and which file has settings that don't appear in both. XML comparison should do the trick, or an XSLT might work. There must be a tool for web.config settings out there?
Yes, there are several tools and methods to compare `web.config` files effectively, focusing on the differences in settings. Here are some options you can consider: ### 1. **Visual Studio's Built-in Diff Tool** If you have Visual Studio, you can use its built-in diff tool to compare files: - Right-click on one of the ...
41,672
[ { "from": "human", "value": "Is there a good tool to compare specifically web.config files to find specifically which settings are different values and which file has settings that don't appear in both.\nXML comparison should do the trick, or an XSLT might work. There must be a tool for web.config settings ...
I was reading about parsers and parser generators and found this statement in wikipedia's LR parsing -page: Many programming languages can be parsed using some variation of an LR parser. One notable exception is C++. Why is it so? What particular property of C++ causes it to be impossible to parse with LR parsers? Us...
The statement that C++ cannot be parsed with a standard LR parser, particularly LR(1), stems from the complexities and ambiguities inherent in the C++ language's grammar. ### Key Reasons C++ Is Difficult to Parse with LR Parsers: 1. **Complexity of the Language**: C++ has a rich and complex grammar that includes feat...
41,974
[ { "from": "human", "value": "I was reading about parsers and parser generators and found this statement in wikipedia's LR parsing -page:\n\nMany programming languages can be parsed using some variation of an LR parser. One notable exception is C++.\n\nWhy is it so? What particular property of C++ causes it ...
I am porting an existing application to C# and want to improve performance wherever possible. Many existing loop counters and array references are defined as System.UInt32, instead of the Int32 I would have used. Is there any significant performance difference for using UInt32 vs Int32?
In C#, both `UInt32` and `Int32` are 32-bit integer types, and their performance characteristics are largely similar when it comes to basic operations like arithmetic, comparisons, and array indexing. Since they are both the same size, they both use the same amount of memory and have similar performance implications in...
39,964
[ { "from": "human", "value": "I am porting an existing application to C# and want to improve performance wherever possible. Many existing loop counters and array references are defined as System.UInt32, instead of the Int32 I would have used.\nIs there any significant performance difference for using UInt32...
I have a business requirement that forces me to store a customer's full credit card details (number, name, expiry date, CVV2) for a short period of time. Rationale: If a customer calls to order a product and their credit card is declined on the spot you are likely to lose the sale. If you take their details, thank them...
Storing credit card details in compliance with industry standards and regulations is critical due to the sensitive nature of this information. The Payment Card Industry Data Security Standard (PCI DSS) has specific requirements for handling and storing credit card information. It's important to ensure your solution ali...
30,492
[ { "from": "human", "value": "I have a business requirement that forces me to store a customer's full credit card details (number, name, expiry date, CVV2) for a short period of time.\nRationale: If a customer calls to order a product and their credit card is declined on the spot you are likely to lose the s...
When measuring network latency (time ack received - time msg sent) in any protocol over TCP, what timer would you recommend to use and why? What resolution does it have? What are other advantages/disadvantages? Optional: how does it work? Optional: what timer would you NOT use and why? I'm looking mostly for Windows / ...
When measuring network latency in Windows/C++, I recommend using the high-resolution timer provided by the Windows API, specifically `QueryPerformanceCounter` and `QueryPerformanceFrequency`. ### Why Use QueryPerformanceCounter? 1. **High Resolution**: `QueryPerformanceCounter` provides a high-resolution timestamp, ...
37,549
[ { "from": "human", "value": "When measuring network latency (time ack received - time msg sent) in any protocol over TCP, what timer would you recommend to use and why? What resolution does it have? What are other advantages/disadvantages?\nOptional: how does it work?\nOptional: what timer would you NOT use...
Is there a way to programatically access the DragHandleTemplate of a ReorderList (ASP.NET AJAX Control Toolkit) ... Specifically during ItemDataBound for the ReorderList, in order to change its appearance at the per item level?
Yes, you can programmatically access and modify the `DragHandleTemplate` of a `ReorderList` in the `ItemDataBound` event in ASP.NET AJAX Control Toolkit. The `ReorderList` allows for custom drag-and-drop reordering of list items, and its appearance can be customized during the binding of data. Here's how you can do th...
41,559
[ { "from": "human", "value": "Is there a way to programatically access the DragHandleTemplate of a ReorderList (ASP.NET AJAX Control Toolkit) ... Specifically during ItemDataBound for the ReorderList, in order to change its appearance at the per item level?\n" }, { "from": "gpt", "value": "Yes, y...
I just started using CCNet, and in the process of getting my build projects set up I racked up a lot of build history from trial and error. I really don't want to keep that old stuff around, but I can't seem to see where/how to get rid of it. I'm sure this is a silly question, and I apologize if I'm overlooking somethi...
No problem at all! It's great that you figured out where the old build histories were stored. For others who may encounter a similar issue with CCNet (CruiseControl.NET), here's a brief overview of how to manage build histories: 1. **Check Artifacts Directory**: As you've discovered, if you configured a custom artifac...
40,942
[ { "from": "human", "value": "I just started using CCNet, and in the process of getting my build projects set up I racked up a lot of build history from trial and error. I really don't want to keep that old stuff around, but I can't seem to see where/how to get rid of it. I'm sure this is a silly question, a...
Please suggest some free tools which will help me to get Lines-of-Code metrics for C# projects using the command line.
There are several free tools that you can use to get Lines-of-Code (LOC) metrics for C# projects from the command line. Here are a few suggestions: 1. **Cloc (Count Lines of Code)**: - **Description**: Cloc is a popular command-line tool that counts blank lines, comment lines, and physical lines of source code in m...
40,764
[ { "from": "human", "value": "Please suggest some free tools which will help me to get Lines-of-Code metrics for C# projects using the command line.\n" }, { "from": "gpt", "value": "There are several free tools that you can use to get Lines-of-Code (LOC) metrics for C# projects from the command l...
SQL Server Full Text Search uses language specific Word Breakers. For the German language this is used to break/split words including compound words. However, it appears not all known compound words are included in the Word Breaker. I would like to know if a list is available of the words the Word Breaker does know ab...
SQL Server's Full Text Search uses a language-specific word breaker for various languages, including German. However, Microsoft does not provide an official, exhaustive list of the compound words and individual words that the German word breaker recognizes. The word breaker is designed to handle compound words and br...
42,202
[ { "from": "human", "value": "SQL Server Full Text Search uses language specific Word Breakers. \nFor the German language this is used to break/split words including compound words. However, it appears not all known compound words are included in the Word Breaker. I would like to know if a list is available ...
I'm relatively new to jQuery, but so far what I've seen I like. What I want is for a div (or any element) to be across the top of the page as if "position: fixed" worked in every browser. I do not want something complicated. I do not want giant CSS hacks. I would prefer if just using jQuery (version 1.2.6) is good enou...
To create a "fixed" position effect for a div across the top of the page using jQuery, you can achieve this with a simple jQuery script that listens for the window's scroll event and adjusts the position of the div accordingly. Since you mentioned you're using jQuery version 1.2.6, keep in mind that this version is qu...
41,089
[ { "from": "human", "value": "I'm relatively new to jQuery, but so far what I've seen I like. What I want is for a div (or any element) to be across the top of the page as if \"position: fixed\" worked in every browser.\nI do not want something complicated. I do not want giant CSS hacks. I would prefer if ju...
Without getting into the details of why, I'm looking for a clean (as possible) way to replace kernel functions and system calls from a loadable module. My initial idea was to write some code to override some functions, which would take the original function (perhaps, if possible, call the function), and then add some ...
Overriding functions in the Linux kernel from a loadable module can be achieved using several approaches, with the most common methods being function hooking or using kprobes. Here’s a brief overview of both methods and how you can implement them: ### 1. Function Hooking Function hooking involves replacing the functi...
35,188
[ { "from": "human", "value": "Without getting into the details of why, I'm looking for a clean (as possible) way to replace kernel functions and system calls from a loadable module. My initial idea was to write some code to override some functions, which would take the original function (perhaps, if possibl...
By default gcc/g++ prints a warning message with the line number only. I am looking for the option by which g++ or gcc associates the build warning messages with the warning ids, so that the warning messages can be identified easily (without parsing). Also can there be any more option to get a more detailed warning mes...
In GCC and G++, you can use the `-fdiagnostics-show-option` option to associate warning messages with their corresponding warning identifiers. When this option is enabled, the compiler will display the specific warning option that was triggered in the diagnostic output, allowing you to identify which warning is being r...
40,407
[ { "from": "human", "value": "By default gcc/g++ prints a warning message with the line number only. I am looking for the option by which g++ or gcc associates the build warning messages with the warning ids, so that the warning messages can be identified easily (without parsing). Also can there be any more ...
How would you map the following in Fluent NHibernate? See "18.3. Customer/Order/Product" http://www.hibernate.org/hib_docs/nhibernate/html/example-mappings.html
To map the entities for a Customer, Order, and Product in Fluent NHibernate as described in the Hibernate documentation, you can define the mappings using Fluent NHibernate's `ClassMap` classes. Below is an example of how you might set up these mappings based on the relationship between Customer, Order, and Product. ...
37,650
[ { "from": "human", "value": "How would you map the following in Fluent NHibernate?\nSee \"18.3. Customer/Order/Product\"\nhttp://www.hibernate.org/hib_docs/nhibernate/html/example-mappings.html\n" }, { "from": "gpt", "value": "To map the entities for a Customer, Order, and Product in Fluent NHib...
Here's the issue: I have a hook in IE that reacts on WebBrowser.OnNavigateComplete2 event to parse the content of the document for some precise info. That document contains frames, so I look into the HTMLDocument.frames. For each one, I look into the document.body.outerHTML property to check for the content. Problem i...
When dealing with frames in a WebBrowser control (especially in an IE environment), it is common to face challenges in accessing the correct content. The `OnNavigateComplete2` event can indeed fire multiple times, especially for each frame being loaded. The content you’re looking for may not be available immediately wh...
39,129
[ { "from": "human", "value": "Here's the issue:\nI have a hook in IE that reacts on WebBrowser.OnNavigateComplete2 event to parse the content of the document for some precise info.\nThat document contains frames, so I look into the HTMLDocument.frames. For each one, I look into the document.body.outerHTML pr...
This came out being incomprehensible. I will rephrase Is there an algorithm or approach that will allow sorting an array in such a way that it minimizes the differences between successive elements? struct element { uint32 positions[8]; } These records are order-insensitive. The output file format is defined to be: ...
To minimize the differences between successive elements in the output file you're generating, you can take a few steps that involve sorting your input array of `struct element` objects effectively. The ultimate goal is to reduce the size of the output file, particularly by minimizing the number of bits in the `present`...
37,932
[ { "from": "human", "value": "This came out being incomprehensible. I will rephrase\nIs there an algorithm or approach that will allow sorting an array in such a way that it minimizes the differences between successive elements? \nstruct element\n{\nuint32 positions[8];\n}\n\nThese records are order-insens...
I want do something like this: Button btn1 = new Button(); btn1.Click += new EventHandler(btn1_Click); Button btn2 = new Button(); // Take whatever event got assigned to btn1 and assign it to btn2. btn2.Click += btn1.Click; // The compiler says no... Where btn1_Click is already defined in the class: void btn1_Click(ob...
In C#, events cannot be directly assigned to each other like properties. You cannot just take the event handler from one control and assign it directly to another control's event. However, you can create a mechanism that allows you to reuse the event handler or a delegate. Here's a practical approach you can use to ac...
41,530
[ { "from": "human", "value": "I want do something like this:\nButton btn1 = new Button();\nbtn1.Click += new EventHandler(btn1_Click);\nButton btn2 = new Button();\n// Take whatever event got assigned to btn1 and assign it to btn2.\nbtn2.Click += btn1.Click; // The compiler says no...\n\nWhere btn1_Click is ...
I Have a problem with my custom Addin to word because sometimes, MS Word was disabled my addin, and I need to write another AddIn, which Was enabled to turn - on/off my first AddIn. Is it possible? sorry for my English :(
Your English is perfectly understandable! It seems like you’re trying to manage the state of a custom Word add-in that may sometimes get disabled by Microsoft Word. Unfortunately, Word does not provide an official API to programmatically enable or disable other add-ins due to security and stability reasons. However, yo...
40,314
[ { "from": "human", "value": "I Have a problem with my custom Addin to word because sometimes, MS Word was disabled my addin, and I need to write another AddIn, which Was enabled to turn - on/off my first AddIn. Is it possible?\nsorry for my English :(\n" }, { "from": "gpt", "value": "Your Engli...
Based on their work, how do you distinguish a great SQL developer? Examples might include: Seldom uses CURSORs, and tries to refactor them away. Seldom uses temporary tables, and tries to refactor them away. Handles NULL values in OUTER JOINs with confidence. Avoids SQL extensions that are not widely implemented. Kno...
Distinguishing a great SQL developer involves evaluating both their technical proficiency and their understanding of best practices. Here are several traits that can indicate a high level of skill and professionalism in SQL development: 1. **Avoids Cursors**: Great SQL developers prefer set-based operations over curso...
40,185
[ { "from": "human", "value": "Based on their work, how do you distinguish a great SQL developer? \nExamples might include:\nSeldom uses CURSORs, and tries to refactor them away.\nSeldom uses temporary tables, and tries to refactor them away.\nHandles NULL values in OUTER JOINs with confidence.\nAvoids SQL e...
I'm curious, is there a way to tell the SQL Server that a specific group has access to the database only from a single location/application. I have an SQL Server and a Web Server. Our applications use stored procedures and access for each stored procedure is based on the role that is allowed to access it. Then user ...
In SQL Server, you can implement some level of access control based on the location or the application making the connection using a combination of techniques. While SQL Server does not natively support limiting access based on the application directly, you can achieve your goal using the following approaches: ### 1. ...
39,592
[ { "from": "human", "value": "I'm curious, is there a way to tell the SQL Server that a specific group has access to the database only from a single location/application. I have an SQL Server and a Web Server. Our applications use stored procedures and access for each stored procedure is based on the role ...
I'm currently using the Yahoo YUI javascript library in a couple of my projects. However, I'm a little concerned about three things. First, they laid off 10% of their employees. Second, their stock price keeps falling: especially after ignoring the MS takeover earlier this year. Third, what if someone does buy the...
Given your concerns about the stability and long-term viability of the Yahoo YUI JavaScript library, here are a few recommendations to consider: 1. **Evaluate Alternatives**: Look into alternative JavaScript libraries or frameworks that have strong community support and are actively maintained. Popular options include...
40,862
[ { "from": "human", "value": "I'm currently using the Yahoo YUI javascript library in a couple of my projects. \nHowever, I'm a little concerned about three things. First, they laid off 10% of their employees. Second, their stock price keeps falling: especially after ignoring the MS takeover earlier this ...
I have heard a few developers recently say that they are simply polling stuff (databases, files, etc.) to determine when something has changed and then run a task, such as an import. I'm really against this idea and feel that utilising available technology such as Remoting, WCF, etc. would be far better than polling. H...
Polling vs. event-driven architecture is a debate that has been ongoing in software development. Here are some reasons why some developers might prefer polling and counterarguments to convince them of the benefits of event-driven approaches: ### Reasons for Polling 1. **Simplicity**: - Polling can be simpler to i...
38,425
[ { "from": "human", "value": "I have heard a few developers recently say that they are simply polling stuff (databases, files, etc.) to determine when something has changed and then run a task, such as an import.\nI'm really against this idea and feel that utilising available technology such as Remoting, WCF...
Is there an similar property like System.getProperty("java.home") that will return the JDK directory instead of the JRE directory? I've looked https://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#getProperties() and there doesn't seem to be anything for the JDK.
In Java, there isn't a direct system property equivalent to `System.getProperty("java.home")` that returns the JDK directory specifically. The `java.home` property will typically point to the root directory of the Java Runtime Environment (JRE) being used, which can be part of a JDK installation. However, you can ofte...
42,559
[ { "from": "human", "value": "Is there an similar property like System.getProperty(\"java.home\") that will return the JDK directory instead of the JRE directory? I've looked https://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#getProperties() and there doesn't seem to be anything for the JDK....
I'm getting a segmentation fault in the following C code: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <netdb.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define PORT 6667 #define MAXDATASIZE 1024 int b...
The segmentation fault in your code is likely caused by the way you're using the `strcat` function to build the message in the `m` array without properly initializing it. When you call `strcat`, it expects the destination string (in this case, `m`) to be null-terminated and already contain a valid string to concatenate...
35,563
[ { "from": "human", "value": "I'm getting a segmentation fault in the following C code:\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <errno.h>\n#include <string.h>\n#include <netdb.h>\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <arpa/inet.h>\...
We have a JavaEE server and servlets providing data to mobile clients (first JavaME, now soon iPhone). The servlet writes out data using the following code: DataOutputStream dos = new DataOutputStream(out); dos.writeInt(someInt); dos.writeUTF(someString); ... and so on This data is returned to the client as bytes in...
To read binary data in Objective-C that has been written out using Java's `DataOutputStream`, you'll need to use the appropriate methods to read integers and strings from the `NSData` object, respecting the format in which the data was written. Here’s a step-by-step guide on how to achieve this: ### Reading the Inte...
37,881
[ { "from": "human", "value": "We have a JavaEE server and servlets providing data to mobile clients (first JavaME, now soon iPhone). The servlet writes out data using the following code:\nDataOutputStream dos = new DataOutputStream(out);\n\ndos.writeInt(someInt);\n\ndos.writeUTF(someString);\n\n... and so on...
var A = { x : function () { } }; var b = function (method) { //want to know method's "parent" here }; b(A.x); I want to know that x is defined in A when I call the b(A.x). Is this possible?
In JavaScript, functions themselves do not inherently carry information about their "parent" or where they were defined from. However, you can achieve a similar effect by using a technique called binding, where you bind the method to its parent object. One way to do this is to pass the parent object alongside the met...
43,470
[ { "from": "human", "value": "var A = {\n x : function () { }\n};\n\nvar b = function (method) {\n //want to know method's \"parent\" here\n};\n\nb(A.x);\n\nI want to know that x is defined in A when I call the b(A.x). Is this possible?\n" }, { "from": "gpt", "value": "In JavaScript, functi...
I'm trying to understand a particular Perl code from vcake. Usually I find my way around in Perl but the following statement baffles me. I suspect that this is simply an error but I'm not completely sure. The statement is: foreach my $seq (keys %$set) { if( (defined $set->{$seq}) and (my $numReads >= ($coverage)) )...
Your confusion is understandable, and it looks like you're analyzing this Perl code closely. Let's break down the problematic line in the context you've provided: ```perl if( (defined $set->{$seq}) and (my $numReads >= ($coverage)) ) { ``` ### Key Observations: 1. **Scope of `$numReads`:** In your code, `my $numReads...
38,700
[ { "from": "human", "value": "I'm trying to understand a particular Perl code from vcake. Usually I find my way around in Perl but the following statement baffles me. I suspect that this is simply an error but I'm not completely sure. The statement is:\nforeach my $seq (keys %$set) {\n if( (defined $set->...
I can't find a pre-built set of MSVC++ libs for Boost 1.37.0, only the source. I don't understand how their weird build system works... are there any places I can find a download of a visual studio project or something?
Boost 1.37.0 is quite an old version, and finding pre-built binaries for it can be a bit challenging since many resources tend to focus on more recent versions. However, you have a few options: 1. **Pre-built Binaries from Boost**: Sometimes the Boost community or specific users provide pre-built binaries for older ve...
40,467
[ { "from": "human", "value": "I can't find a pre-built set of MSVC++ libs for Boost 1.37.0, only the source. I don't understand how their weird build system works... are there any places I can find a download of a visual studio project or something?\n" }, { "from": "gpt", "value": "Boost 1.37.0 i...
Of course, the immediate answer for most situations is "yes", and I am a firm believer that a process should correctly cleanup any resources it has allocated, but what I have in my situation is a long-running system daemon that opens a fixed number of file descriptors at the startup, and closes them all before exiting....
In general, it is considered good practice to close all file descriptors that a program has opened, even if the operating system will automatically clean them up when the process exits. Here are a few reasons why you should still explicitly close file descriptors: 1. **Resource Management**: Explicitly closing file de...
41,438
[ { "from": "human", "value": "Of course, the immediate answer for most situations is \"yes\", and I am a firm believer that a process should correctly cleanup any resources it has allocated, but what I have in my situation is a long-running system daemon that opens a fixed number of file descriptors at the s...
Is it possible to determine whether a particular youtube video is encoded with H.264 or FLV through the YouTube data API? If so, how? I can start a file download and check how the video stream was encoded (programmatically, of course), but I'd like to use the YouTube data API to avoid all that overhead.
The YouTube Data API does not provide direct access to the encoding information of videos, such as whether they are encoded with H.264 or FLV. The API focuses more on metadata related to the videos, such as titles, descriptions, view counts, etc. To get the encoding information, you typically need to download the vide...
43,099
[ { "from": "human", "value": "Is it possible to determine whether a particular youtube video is encoded with H.264 or FLV through the YouTube data API? If so, how? \nI can start a file download and check how the video stream was encoded (programmatically, of course), but I'd like to use the YouTube data API ...
As the title says. How would I create an instance of a class that is globally available(for example I have a functor for printing and i want to have a single global instance of this(though the possibility of creating more)).
To create a globally available instance of a class in C++, you typically use a `static` variable or define a global instance outside of any function or class. Below is an example using both methods, specifically for a functor designed for printing. ### Example Functor Here's a simple functor that prints a message: `...
37,206
[ { "from": "human", "value": "As the title says. How would I create an instance of a class that is globally available(for example I have a functor for printing and i want to have a single global instance of this(though the possibility of creating more)).\n" }, { "from": "gpt", "value": "To creat...
I'm doing some straight up asynchronous calls from javascript using the XMLHTTPRequest object. On success, with certain return values, I would like to do an asynchonous post back on an update panel and run some server side methods. This is about how I'm implementing it now: <script language="javascript"> functio...
Yes, you can definitely simplify your approach without needing to rely on a hidden button to trigger the asynchronous postback in the UpdatePanel. Instead of using a hidden button click, you can directly call the `__doPostBack` JavaScript function that ASP.NET provides to perform a postback from your JavaScript code. ...
41,786
[ { "from": "human", "value": "I'm doing some straight up asynchronous calls from javascript using the XMLHTTPRequest object. On success, with certain return values, I would like to do an asynchonous post back on an update panel and run some server side methods. This is about how I'm implementing it now:\n<s...
I am using visual studio 2008 professional and was wondering, how can I have different colours for method calls within class methods, and for properties/fields? This would be good as it would give me a quick visual overview of what my class has too much of (e.g. 20 fields and 2 methods - which will give me some interes...
In Visual Studio 2008, there are limited options for customizing the syntax highlighting for method calls and properties/fields directly within the editor. Unfortunately, Visual Studio does not provide built-in functionality to specifically change the color of method calls and properties/fields based on your requiremen...
40,932
[ { "from": "human", "value": "I am using visual studio 2008 professional and was wondering, how can I have different colours for method calls within class methods, and for properties/fields? This would be good as it would give me a quick visual overview of what my class has too much of (e.g. 20 fields and 2 ...
I want to start using Nunit (finally), I am using Visual Studio 2008. Is it as simple as importing Nunit into my test project? I remember seeing a GUI for NUnit, does that do the exact same thing that a separate test project would do, except show you the pass/fail visually?
Yes, starting with NUnit in Visual Studio 2008 is quite straightforward. Here's a brief guide to help you get started: ### Setting Up NUnit 1. **Download NUnit**: First, you need to download the NUnit framework. Since you are using Visual Studio 2008, you will need a version of NUnit compatible with it, likely NUnit ...
37,691
[ { "from": "human", "value": "I want to start using Nunit (finally), I am using Visual Studio 2008.\nIs it as simple as importing Nunit into my test project?\nI remember seeing a GUI for NUnit, does that do the exact same thing that a separate test project would do, except show you the pass/fail visually?\n"...
I am working with Rails fixtures for testing my rails application. It is all good except one of my database columns is supposed to hold YAML content. But, I am sure how to put the YAML markup I want to load into my database inside the YAML file. Here is an example: mvnforum: name: mvnforum abstraction_type: ...
You can include YAML content in your fixtures by using proper escaping to ensure that the YAML parser interprets it correctly. Since YAML uses indentation and colons for key-value pairs, any content you want to store that includes colons and other special characters must be properly formatted to avoid confusion with YA...
40,705
[ { "from": "human", "value": "I am working with Rails fixtures for testing my rails application. It is all good except one of my database columns is supposed to hold YAML content. But, I am sure how to put the YAML markup I want to load into my database inside the YAML file. Here is an example:\nmvnforum:...
I have two files with slight differences. A normal diff will show me the differences between the files. With -c or -u I can add an amount of context to each hunk. What options can I pass to diff to see every unchanged line alongside the changes, and get the diff as a single, large hunk?
To see every unchanged line alongside the changes while getting the diff as a single, large hunk, you can use the `--unified` option of the `diff` command along with a very large context size. This way, you will be able to view all unchanged lines in the output. Here is how you can do it: ```bash diff -U999999 file1....
43,324
[ { "from": "human", "value": "I have two files with slight differences. A normal diff will show me the differences between the files. With -c or -u I can add an amount of context to each hunk. What options can I pass to diff to see every unchanged line alongside the changes, and get the diff as a single, ...
In the Windows Mobile SDK, there is a MessagingApplication class in Microsoft.WindowsMobile.PocketOutlook that has a method "DisplayComposeForm" that allows you to bring up the default compose dialog for sending an SMS. I need a way to display the default message viewing dialog from managed code. I.e. i've retrieved th...
To display the default message viewing dialog in Windows Mobile from managed code, you can use the `MessagingApplication` class from the `Microsoft.WindowsMobile.PocketOutlook` namespace. Although this class primarily provides functionality for composing new messages, you can utilize the `MessagingApplication` and some...
40,482
[ { "from": "human", "value": "In the Windows Mobile SDK, there is a MessagingApplication class in Microsoft.WindowsMobile.PocketOutlook that has a method \"DisplayComposeForm\" that allows you to bring up the default compose dialog for sending an SMS.\nI need a way to display the default message viewing dial...
I have a .NET 2.0 server that seems to be running into scaling problems, probably due to poor design of the socket-handling code, and I am looking for guidance on how I might redesign it to improve performance. Usage scenario: 50 - 150 clients, high rate (up to 100s / second) of small messages (10s of bytes each) to / ...
It sounds like you are facing some performance issues with your socket handling code in a .NET 2.0 application, particularly under a higher load of clients and messages. Here are several suggestions to help you redesign your socket handling to improve performance: ### 1. Switch to Asynchronous Socket Handling Instead...
37,949
[ { "from": "human", "value": "I have a .NET 2.0 server that seems to be running into scaling problems, probably due to poor design of the socket-handling code, and I am looking for guidance on how I might redesign it to improve performance.\nUsage scenario: 50 - 150 clients, high rate (up to 100s / second) o...
I am developing a website using CodeIgniter and PHP. Some of my friends suggest I start using Subversion to take care of my organization. Could someone give me a basic explanation of what SVN is without the jargon and also if it is practical for a framework where 5 files are needed to run a single page?
Sure! Subversion, often abbreviated as SVN, is a tool used for version control. Think of it as a filing system for your project's files. Here’s a simple breakdown: 1. **Version Control**: It helps you track changes to your files over time. If you modify a file and then later want to go back to the previous version, SV...
39,233
[ { "from": "human", "value": "I am developing a website using CodeIgniter and PHP. Some of my friends suggest I start using Subversion to take care of my organization. Could someone give me a basic explanation of what SVN is without the jargon and also if it is practical for a framework where 5 files are n...
Given a list of sets: S_1 : [ 1, 2, 3, 4 ] S_2 : [ 3, 4, 5, 6, 7 ] S_3 : [ 8, 9, 10, 11 ] S_4 : [ 1, 8, 12, 13 ] S_5 : [ 6, 7, 14, 15, 16, 17 ] What the most efficient way to merge all sets that share at least 2 elements? I suppose this is similar to a connected components problem. So the result would be: [ 1, 2, ...
To efficiently merge sets that share at least 2 elements, we can use a union-find (disjoint set) data structure along with a mapping of elements to the sets they belong to. This will allow us to manage connections and efficiently merge the relevant sets. Here’s a high-level outline of the approach, followed by a Python...
35,838
[ { "from": "human", "value": "Given a list of sets:\n\nS_1 : [ 1, 2, 3, 4 ]\nS_2 : [ 3, 4, 5, 6, 7 ]\nS_3 : [ 8, 9, 10, 11 ]\nS_4 : [ 1, 8, 12, 13 ]\nS_5 : [ 6, 7, 14, 15, 16, 17 ]\n\nWhat the most efficient way to merge all sets that share at least 2 elements? I suppose this is similar to a connected compo...
We are developing a small in-house application that will run on monitor having multi resolutions. Now we want that the application should adjust itself and remain consistent over all monitors. I came from a Java background too where we used different layouts to accomplish the task. I experimented in .NET with different...
In WPF (Windows Presentation Foundation), achieving a responsive layout that adapts well to different resolutions and screen sizes can be accomplished through the use of various layout containers and properties. Here are some recommendations: ### Layout Containers 1. **Grid**: - The `Grid` layout is very versatile...
37,734
[ { "from": "human", "value": "We are developing a small in-house application that will run on monitor having multi resolutions. Now we want that the application should adjust itself and remain consistent over all monitors.\nI came from a Java background too where we used different layouts to accomplish the t...
I have an interface called Dictionary which has a method insert(). This interface is implemented by class BSTree, but I also have a class AVLTree which is a child class of BSTree. AVLTree redefines the insert() so it suits it's needs. Now if I type the following code: Dictionary data=new AVLTree(); data.insert(); Ther...
The issue you are experiencing is related to how Java (or many object-oriented programming languages) manages method resolution through polymorphism. In your code: ```java Dictionary data = new AVLTree(); data.insert(); ``` If `insert()` is defined in the `Dictionary` interface, and the method is not overridden in ...
40,741
[ { "from": "human", "value": "I have an interface called Dictionary which has a method insert(). This interface is implemented by class BSTree, but I also have a class AVLTree which is a child class of BSTree. AVLTree redefines the insert() so it suits it's needs. Now if I type the following code:\nDictionar...
Actually my question is all in the title. Anyway: I have a class and I use explicit constructor: .h class MyClass { public: explicit MyClass(const string& s): query(s) {} private: string query; } Is it obligatory or not to put explicit keyword in implementation(.cpp) file?
The `explicit` keyword is used in C++ to prevent implicit conversions and copy-initialization, which can lead to unintended behavior. When you declare a constructor as `explicit` in the class declaration (in the `.h` file), that specification applies to all implementations of that constructor, regardless of whether the...
43,200
[ { "from": "human", "value": "Actually my question is all in the title.\nAnyway:\nI have a class and I use explicit constructor:\n.h\nclass MyClass\n{\n public:\n explicit MyClass(const string& s): query(s) {}\n private:\n string query;\n}\n\nIs it obligatory or not to put explicit keyword in implemen...
I was wondering if there was a way to determine if the last column is fully displayed. I know there is a Displayed property on a column, but that property is true if the column is either partially or fully displayed. I only want it if the column is fully displayed.
To determine if the last column is fully displayed in a data table or grid, you need to check more than just the `Displayed` property. You'll want to ensure that the entire width of the last column is within the visible area of the table or grid. Here's a general approach you can follow, which may vary depending on the...
39,238
[ { "from": "human", "value": "I was wondering if there was a way to determine if the last column is fully displayed.\nI know there is a Displayed property on a column, but that property is true if the column is either partially or fully displayed. I only want it if the column is fully displayed.\n" }, { ...
I need to create a site map/list, but I need the link-name to show up as well. What I mean by that is given, say, www.google.com, I need the following list to be created. Google - www.google.com Images - http://images.google.com/imghp?hl=en&tab=wi ... My Account - http://images.google.com/imghp?hl=en&tab=wi Persona...
Creating a site map that captures both the link names and URLs for a given domain can be challenging, especially if you want to traverse the entire site. Here's a general approach to accomplish this using Python. Since you've mentioned you've tried using Beautiful Soup unsuccessfully, I'll provide a structured way to c...
37,370
[ { "from": "human", "value": "I need to create a site map/list, but I need the link-name to show up as well.\nWhat I mean by that is given, say, www.google.com, I need the following list to be created.\nGoogle - www.google.com\nImages - http://images.google.com/imghp?hl=en&tab=wi\n...\nMy Account - http://im...
I'm extremely new to Java, and have mostly just been teaching myself as I go, so I've started building an applet. I'd like to make one that can select a file from the local disk and upload it as a multipart/form-data POST request but with a progress bar. Obviously the user has to grant permission to the Java applet to ...
Creating a Java applet that allows users to upload files and monitor the upload progress with a progress bar is quite an interesting project! Below, I will guide you through the basic steps to implement the file upload functionality along with a progress bar in a Java applet. ### Steps to Upload a File in a Java Apple...
31,509
[ { "from": "human", "value": "I'm extremely new to Java, and have mostly just been teaching myself as I go, so I've started building an applet. I'd like to make one that can select a file from the local disk and upload it as a multipart/form-data POST request but with a progress bar. Obviously the user has t...
I've written a simple calendar control to allow for selecting single days, weeks, months and so on. The simplicity comes from the fact that I don't really do any drawing myself, opting instead to create a bunch of boxes and labels to act as date cells for the calendar. When a date or a date range is selected, I need ...
In Flex, similar to Windows Forms, you can manage the rendering and updating of your UI components to avoid flickering and delays during updates. While there isn't a direct equivalent to `SuspendLayout`, you can achieve smoother updates by using a couple of different techniques. Here are some strategies you can consid...
30,842
[ { "from": "human", "value": "I've written a simple calendar control to allow for selecting single days, weeks, months and so on. The simplicity comes from the fact that I don't really do any drawing myself, opting instead to create a bunch of boxes and labels to act as date cells for the calendar. \nWhen a...
I'm using Visual Studio 2008 Professional Edition. In previous versions, there has been integration with VSS, through which one could "open from SourceSafe" and then, in the solution view, have the ability to interact with the source control by clicking on individual files. I seem to have some integration under 2008, n...
Visual Studio 2008 does support integration with Visual SourceSafe (VSS), but you may need to ensure that the proper settings and extensions are configured to achieve a similar experience to what you had in Visual Studio 2005. Here are some steps you can follow to get the SourceSafe integration working in Visual Studio...
41,078
[ { "from": "human", "value": "I'm using Visual Studio 2008 Professional Edition. In previous versions, there has been integration with VSS, through which one could \"open from SourceSafe\" and then, in the solution view, have the ability to interact with the source control by clicking on individual files. I ...
I want to test a feature coming with SVNKit 1.2.1, which is not yet available on the update sites of the Eclipse or the Polarion project. I got a checkout as described under "Latest Development Version" on svnkit.com/download.php, successfully built it with ant and successfully installed it with the Eclipses software m...
It sounds like you've done a lot of the right steps to get SVNKit 1.2.1 set up in Eclipse. However, there might be a few things you can check to ensure that SVNKit is correctly recognized as a connector: 1. **Check the Installation**: Make sure that the SVNKit plugin is correctly installed. In Eclipse, go to `Help > A...
39,829
[ { "from": "human", "value": "I want to test a feature coming with SVNKit 1.2.1, which is not yet available on the update sites of the Eclipse or the Polarion project.\nI got a checkout as described under \"Latest Development Version\" on svnkit.com/download.php, successfully built it with ant and successful...
I am looking for example code that provides a unit test to serialize and deserialize an object from a memory stream. I have found examples using C# 2.0, however my current project uses VB.NET 1.1 (don't ask me why...), so the solution can not use generics. I am also using the NUnit framework for the unit tests. Thank...
Certainly! Below is a simple example of how you can serialize and deserialize an object from a memory stream using VB.NET 1.1. I will create a simple class, and then use the NUnit framework to create unit tests for the serialization and deserialization. ### The Object to Serialize First, let's create a simple class t...
41,420
[ { "from": "human", "value": "I am looking for example code that provides a unit test to serialize and deserialize an object from a memory stream. I have found examples using C# 2.0, however my current project uses VB.NET 1.1 (don't ask me why...), so the solution can not use generics. I am also using the ...
I mean what the most efficient way to get information about the quantity of your page's items and make sql query with LIMIT that you need. or I should get all items and then crop array with php functions? now I do 2 queries: first to count all items and second to get items that I need with LIMIT. OK, I'll be more c...
The approach you're currently using—executing two separate SQL queries to first count the items and then retrieve a specific set of items—is a common and efficient method for handling pagination in SQL. However, there are some strategies you can use to optimize or streamline your process. Below are some options to cons...
39,344
[ { "from": "human", "value": "I mean what the most efficient way to get information about the quantity of your page's items and make sql query with LIMIT that you need. or I should get all items and then crop array with php functions?\nnow I do 2 queries: first to count all items and second to get items that...
Is there a generic container implementing the 'set' behaviour in .NET? I know I could just use a Dictionary<T, Object> (and possibly add nulls as values), because its keys act as a set, but I was curious if there's something ready-made.
Yes, .NET provides a generic container that implements the behavior of a set: `HashSet<T>`. This class is part of the `System.Collections.Generic` namespace and is designed specifically for storing a collection of unique elements. Here's a quick overview of `HashSet<T>`: - It automatically handles duplicates for you...
42,701
[ { "from": "human", "value": "Is there a generic container implementing the 'set' behaviour in .NET?\nI know I could just use a Dictionary<T, Object> (and possibly add nulls as values), because its keys act as a set, but I was curious if there's something ready-made.\n" }, { "from": "gpt", "value...
I'm building an English web dictionary where users can type in words and get definitions. I thought about this for a while and since the data is 100% static and I was only to retrieve one word at a time I was better off using the filesystem (ext3) as the database system instead of opting to use MySQL to store definitio...
Your approach to building an English web dictionary using a filesystem-based solution for static data retrieval has both its advantages and potential drawbacks, especially when you consider high traffic scenarios. Let’s break it down: ### Advantages of Filesystem-based Approach 1. **Simplicity**: Using the filesystem ...
37,687
[ { "from": "human", "value": "I'm building an English web dictionary where users can type in words and get definitions. I thought about this for a while and since the data is 100% static and I was only to retrieve one word at a time I was better off using the filesystem (ext3) as the database system instead ...
Is there an easy way to figure out, preferably from the command line, what profiles are available for a particular project. I've got a big, multi-module project I'm trying to figure out.
Yes, you can easily figure out the available profiles for a multi-module project using the command line, especially if you are working with a Maven or Gradle project. ### For Maven: If your project is a Maven project, you can use the following command to list all available profiles: ```bash mvn help:all-profiles ```...
42,916
[ { "from": "human", "value": "Is there an easy way to figure out, preferably from the command line, what profiles are available for a particular project. I've got a big, multi-module project I'm trying to figure out.\n" }, { "from": "gpt", "value": "Yes, you can easily figure out the available pr...
I have this code, which works fine, but I would like to be able to make it so when an image appears the text layer disapears, and there would be a link to bring the xt back and remove the image. How would I do this..., something to do with changing isibility and overlaying? <html> <script type="text/javascript"> ...
To achieve the functionality where an image appears and the text layer disappears, and you can toggle back to show the text while hiding the image, you can modify your code as follows: 1. Add an `<img>` element that represents the image you want to display. 2. Use JavaScript to toggle the visibility of the text and im...
38,761
[ { "from": "human", "value": "I have this code, which works fine, but I would like to be able to make it so when an image appears the text layer disapears, and there would be a link to bring the xt back and remove the image. How would I do this..., something to do with changing isibility and overlaying?\n<ht...
in Perl, when I do use <module name> <ver>;, the system finds the .pm file for the library somewhere in the @INC path. Is there a reliable way to which file was actually loaded?
Yes, in Perl, you can determine which file was loaded for a specific module by checking the `%INC` hash. The `%INC` hash is a built-in Perl hash that contains the filenames of all modules that have been loaded, indexed by their module names. When you use `use <module name> <ver>;`, Perl will store the path to the loade...
42,484
[ { "from": "human", "value": "in Perl, when I do use <module name> <ver>;, the system finds the .pm file for the library somewhere in the @INC path.\nIs there a reliable way to which file was actually loaded?\n" }, { "from": "gpt", "value": "Yes, in Perl, you can determine which file was loaded f...
I have been working on a legacy C++ application and am definitely outside of my comfort-zone (a good thing). I was wondering if anyone out there would be so kind as to give me a few pointers (pun intended). I need to cast 2 bytes in an unsigned char array to an unsigned short. The bytes are consecutive. For an example...
It looks like you're on the right track with your casting, but the issue you're encountering is likely due to how you're combining the two bytes into an `unsigned short`. In your case, you want to combine two consecutive bytes from the `unsigned char` array into an `unsigned short` value, treating the second byte as ...
35,720
[ { "from": "human", "value": "I have been working on a legacy C++ application and am definitely outside of my comfort-zone (a good thing). I was wondering if anyone out there would be so kind as to give me a few pointers (pun intended).\nI need to cast 2 bytes in an unsigned char array to an unsigned short. ...
I have an application running on multiple IIS servers that need to parse a CSV file that is placed on a common network drive. If I use the System.IO.FileSystemWatcher Created event to be notified of the event when the file is available, how can I ensure only one server parses the file? If all servers are notified of ...
To handle the scenario of multiple IIS servers parsing a CSV file from a common network drive while preventing duplicate parsing and database inserts, you need to implement a coordination mechanism. Here are several approaches you could consider: ### Approach 1: Use a Distributed Lock 1. **Implement a Distributed Loc...
39,335
[ { "from": "human", "value": "I have an application running on multiple IIS servers that need to parse a CSV file that is placed on a common network drive. If I use the System.IO.FileSystemWatcher Created event to be notified of the event when the file is available, how can I ensure only one server parses t...
There are no builtin matrix functions in C#, but there are in the F# powerpack. Rather than using a third party or open source C# library, I wonder about rolling my own in F#, and exposing the useful bits to C#. Wondered if anybody has already thought of this, or tried it, and whether it's a good idea. Should I expose...
It's great to see that you're considering building your own matrix functionality in F# and making it accessible to C#. Using F# for this purpose can be beneficial because of its strong support for functional programming and immutability, which can lead to more concise and expressive code. ### Exposing F# to C# When i...
38,312
[ { "from": "human", "value": "There are no builtin matrix functions in C#, but there are in the F# powerpack.\nRather than using a third party or open source C# library, I wonder about rolling my own in F#, and exposing the useful bits to C#. \nWondered if anybody has already thought of this, or tried it, an...
I have an abstract base class and I want to declare a field or a property that will have a different value in each class that inherits from this parent class. I want to define it in the baseclass so I can reference it in a base class method - for example overriding ToString to say "This object is of type property/fiel...
You've raised a great question about how to handle properties in an abstract base class and the implications of different approaches. Your instincts are correct, and it's good to see you analyzing the various options available to you. Let's break down your options and explore why Option 1 is indeed the most accepted an...
40,035
[ { "from": "human", "value": "I have an abstract base class and I want to declare a field or a property that will have a different value in each class that inherits from this parent class. \nI want to define it in the baseclass so I can reference it in a base class method - for example overriding ToString to...
How do you look up a user in Active Directory? Some example usernames are: avatopia\ian avatar\ian ian@avatopia.com ian@avatopia.local avatopia.com\ian It's important to note that i don't know the name of the domain, and i shouldn't be hard-coding it. There is some sample code on stack-overflow that fails. using Sys...
To look up a user in Active Directory without needing to specify the domain explicitly, you can make use of the `System.DirectoryServices` namespace along with the `DirectorySearcher` class. Instead of parsing the username to extract the domain, you can query the directory for the user based on various formats of the u...
39,664
[ { "from": "human", "value": "How do you look up a user in Active Directory?\nSome example usernames are:\n\navatopia\\ian\navatar\\ian\nian@avatopia.com\nian@avatopia.local\navatopia.com\\ian\n\nIt's important to note that i don't know the name of the domain, and i shouldn't be hard-coding it.\nThere is som...
Any idea how I express 'implements' in UML? I'm trying to write some actionscript classes in starUML with the help of this handy little template tool: http://blog.flashmech.net/2008/09/generate-actionscript-3-with-staruml/ I want the tool to generate 'implements Iblah' in the classes but am not sure what connector to ...
In UML, the term 'implements' is used to denote that a class is implementing an interface. The correct way to express this relationship in UML is through a **realization relationship**. ### How to Represent 'Implements' in UML: 1. **Realization Relationship**: This relationship is typically depicted with a dashed lin...
42,938
[ { "from": "human", "value": "Any idea how I express 'implements' in UML?\nI'm trying to write some actionscript classes in starUML with the help of this handy little template tool: \nhttp://blog.flashmech.net/2008/09/generate-actionscript-3-with-staruml/\nI want the tool to generate 'implements Iblah' in th...
I am using Maven (and the Maven Eclipse Integration) to manage the dependencies for my Java projects in Eclipse. The automatic download feature for JAR files from the Maven repositories is a real time saver. Unfortunately, it does not include API documentation and source code. How can I set up Maven to automatically al...
To configure Maven to automatically download the source and Javadoc attachments for your dependencies in Eclipse, you can follow these steps: ### Step 1: Configure Maven to Download Sources and Javadocs You need to modify your Maven settings to include options for downloading sources and Javadocs. You can do this by ...
37,220
[ { "from": "human", "value": "I am using Maven (and the Maven Eclipse Integration) to manage the dependencies for my Java projects in Eclipse. The automatic download feature for JAR files from the Maven repositories is a real time saver. Unfortunately, it does not include API documentation and source code.\n...
For testing purposes I need to get my Outlook 2003 addin (vb.net) disabled so that it can only be reactivated through the help menu or by deleting the resilency key from within the registry. I tried to achieve this by creating an unhandled invalid cast exception during the startup eventhandler but this does not help. O...
To disable your Outlook 2003 add-in so that it can only be reactivated through the Help menu or by deleting the resiliency key from the registry, you typically need to throw a specific type of exception during the startup process of the add-in. However, throwing an `InvalidCastException` may not trigger the proper resp...
41,175
[ { "from": "human", "value": "For testing purposes I need to get my Outlook 2003 addin (vb.net) disabled so that it can only be reactivated through the help menu or by deleting the resilency key from within the registry.\nI tried to achieve this by creating an unhandled invalid cast exception during the star...
I have already visited Preferred Python unit-testing framework. I am not just looking at Python Unit Testing Framework, but also code coverage with respect to unit tests. So far I have only come across coverage.py. Is there any better option? An interesting option for me is to integrate cpython, unit testing of Python ...
When it comes to code coverage for Python unit tests, `coverage.py` is indeed the most widely used tool. It provides detailed reports on code execution and integrates well with many testing frameworks. If you are looking for alternatives or additional tools, you might consider: 1. **pytest-cov**: This is a plugin for ...
39,914
[ { "from": "human", "value": "I have already visited Preferred Python unit-testing framework. I am not just looking at Python Unit Testing Framework, but also code coverage with respect to unit tests. So far I have only come across coverage.py. Is there any better option?\nAn interesting option for me is to ...
Does this pattern: setTimeout(function(){ // do stuff }, 0); Actually return control to the UI from within a loop? When are you supposed to use it? Does it work equally well in all browsers?
Yes, the pattern you’ve described using `setTimeout` with a delay of 0 milliseconds can be used to return control to the UI in JavaScript, especially when it’s executed within a long-running loop or a heavy computation. Here's a brief explanation of how it works and when to use it: ### How it Works When you call `set...
36,576
[ { "from": "human", "value": "Does this pattern:\nsetTimeout(function(){\n // do stuff\n}, 0);\n\nActually return control to the UI from within a loop? When are you supposed to use it? Does it work equally well in all browsers?\n" }, { "from": "gpt", "value": "Yes, the pattern you’ve ...
The last week on the ACM ICPC Mexico competition, I missed a "return 0" on a C++ program. For this reason we got punished with 20 minutes. I had read that the standard does not oblige us to write it at the end of a main function. It is implicit, isn't it? How can I prove it? We were using a Fedora system with a G++ co...
In C++, if you omit the `return 0;` statement at the end of the `main` function, the C++ standard specifies that the function will automatically return 0. This behavior was specified in the C++ standard, so you can refer to that as a basis for your argument. Here's how you can approach proving this point: ### Referenc...
40,702
[ { "from": "human", "value": "The last week on the ACM ICPC Mexico competition, I missed a \"return 0\" on a C++ program. For this reason we got punished with 20 minutes.\nI had read that the standard does not oblige us to write it at the end of a main function. It is implicit, isn't it? How can I prove it? ...
I am really new to Python and I have been looking for an example on how to write a Web Service (XML - SOAP) in Python with Google App Engine with no luck. Can anyone point me to an article or give me an example on how to do this?
Creating a SOAP web service in Python, especially on Google App Engine, involves several steps. While Google App Engine supports Python, implementing SOAP can be a bit more complex because SOAP services are not as common in modern web development compared to REST APIs. However, I'll guide you through the steps to set u...
38,806
[ { "from": "human", "value": "I am really new to Python and I have been looking for an example on how to write a Web Service (XML - SOAP) in Python with Google App Engine with no luck. \nCan anyone point me to an article or give me an example on how to do this?\n" }, { "from": "gpt", "value": "C...
I have a WCF service which will be hosted under IIS. Now I have some resources(Connections) that I create within service constructor. I need to free up those resources when IIS which is hosting the service shuts down or resets. These are not the resources that I will be clearing out every time client disconnects but th...
In a WCF service hosted in IIS, you can manage the lifecycle of your resources using the `ServiceHost` class. To clean up resources when the service is shutting down or when the IIS is resetting, you can implement the `IServiceBehavior` interface and attach it to your service host. This will allow you to listen for eve...
40,213
[ { "from": "human", "value": "I have a WCF service which will be hosted under IIS. Now I have some resources(Connections) that I create within service constructor. I need to free up those resources when IIS which is hosting the service shuts down or resets. These are not the resources that I will be clearing...
I'm writing a global error handling "module" for one of my applications. One of the features I want to have is to be able to easily wrap a function with a try{} catch{} block, so that all calls to that function will automatically have the error handling code that'll call my global logging method. (To avoid polluting th...
You're correct to think about the implications of the `this` keyword when wrapping functions, especially when they are methods of an object. In JavaScript, the value of `this` is determined by how a function is called, not where it's defined. Your `TryCatchWrap` method does preserve the context of `this` because you'...
41,285
[ { "from": "human", "value": "I'm writing a global error handling \"module\" for one of my applications.\nOne of the features I want to have is to be able to easily wrap a function with a try{} catch{} block, so that all calls to that function will automatically have the error handling code that'll call my g...
I have a dev branch that hasn't been touched for a while. I merged the trunk into it to integrate many fixes/changes in the main line since it was branched out, but now I have many small conflicts (merge-left/merge-right). I want the latest trunk revision to be used to resolve each conflict. Is there a command I can ru...
If you are using an older version of Subversion (SVN 1.0), you may not have access to the `--accept` option that allows for automatic resolution of merge conflicts. However, you can still resolve conflicts in one direction (using "merge-right") by using the `svn resolve` command. Here’s a step-by-step approach to res...
40,739
[ { "from": "human", "value": "I have a dev branch that hasn't been touched for a while. I merged the trunk into it to integrate many fixes/changes in the main line since it was branched out, but now I have many small conflicts (merge-left/merge-right).\nI want the latest trunk revision to be used to resolve ...
I would like to set up a proxy server on Fedora Core 4. Any idea of which ones might be easy to set up? I would like to connect through that server and receive an IP address from my ISP, since I have IP-address filtering on my apache server. Squid is an option, but I'm not sure how easy or hard it is to set up. Thank...
Setting up a proxy server on Fedora Core 4 can be a great way to manage IP address filtering with Apache. Among the various options available, **Squid** is one of the most popular and well-documented proxy servers, and it can be set up relatively easily. Here's a general guideline on how to install and configure Squid ...
36,599
[ { "from": "human", "value": "I would like to set up a proxy server on Fedora Core 4. Any idea of which ones might be easy to set up? I would like to connect through that server and receive an IP address from my ISP, since I have IP-address filtering on my apache server.\nSquid is an option, but I'm not su...
int x; printf("hello %n World\n", &x); printf("%d\n", x);
In the provided code snippet, the `printf` function is used in a somewhat interesting way with the format specifier `%n`. Let's break down the code: ```c #include <stdio.h> int main() { int x; printf("hello %n World\n", &x); printf("%d\n", x); return 0; } ``` ### Explanation 1. **Variable Declaratio...
42,438
[ { "from": "human", "value": "int x;\nprintf(\"hello %n World\\n\", &x);\nprintf(\"%d\\n\", x);\n\n" }, { "from": "gpt", "value": "In the provided code snippet, the `printf` function is used in a somewhat interesting way with the format specifier `%n`. Let's break down the code:\n\n```c\n#include...
I'm trying to use System.IO.File.Replace to update a file, and it's throwing System.IOException if the destination file is on a NAS. According to MSDN, if the destination file is on a different volume, this method throws an exception. It's right, but how do I detect if two files are on "different volumes"? Path.GetPath...
To determine if two file paths are on different volumes, you can compare the volume identifiers of the two paths. This can be done by getting the root path of each file and then comparing their respective volume information. Here's a method that will help you achieve this: 1. Get the root directory of both paths. 2. ...
41,516
[ { "from": "human", "value": "I'm trying to use System.IO.File.Replace to update a file, and it's throwing System.IOException if the destination file is on a NAS.\nAccording to MSDN, if the destination file is on a different volume, this method throws an exception. It's right, but how do I detect if two file...
Can someone explain the difference between: lock (someobject) {} Using Mutex Using Semaphore Using Monitor Using Other .Net synchronization classes I just can't figure it out. It seems to me the first two are the same?
Certainly! In .NET, there are several synchronization primitives you can use to manage access to shared resources among multiple threads. Here’s a breakdown of the differences between using `lock`, `Mutex`, `Semaphore`, `Monitor`, and other synchronization classes. ### 1. `lock (someobject) {}` The `lock` statement i...
37,939
[ { "from": "human", "value": "Can someone explain the difference between:\n\nlock (someobject) {}\nUsing Mutex\nUsing Semaphore\nUsing Monitor\nUsing Other .Net synchronization classes\n\nI just can't figure it out. It seems to me the first two are the same?\n" }, { "from": "gpt", "value": "Cert...
In java.util.Calendar, January is defined as month 0, not month 1. Is there any specific reason to that ? I have seen many people getting confused about that...
The decision to make January month 0 in `java.util.Calendar` can indeed be confusing for developers who are more accustomed to the common human convention of numbering months starting from 1. However, there are some reasons and historical context that contribute to this design choice: 1. **Zero-Based Indexing**: Many ...
41,295
[ { "from": "human", "value": "In java.util.Calendar, January is defined as month 0, not month 1. Is there any specific reason to that ?\nI have seen many people getting confused about that...\n" }, { "from": "gpt", "value": "The decision to make January month 0 in `java.util.Calendar` can indeed ...