instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
We are using Team City and I noticed problem during running Watin test. Sometimes some instance of IE randomly just don't stop in task manager on build server, even if test closes all opened instances. This causes failure of all tests that follows. We tried with script that kills all instances of ie before this test st...
It sounds like you're dealing with a frustrating issue where Internet Explorer (IE) instances are not terminating properly, which can lead to failures in subsequent tests in your CI/CD pipeline. Here are some potential solutions and best practices you can try to mitigate this issue: ### 1. Ensure Proper Disposal in Yo...
30,534
[ { "from": "human", "value": "We are using Team City and I noticed problem during running Watin test. Sometimes some instance of IE randomly just don't stop in task manager on build server, even if test closes all opened instances. This causes failure of all tests that follows.\nWe tried with script that kil...
I'm using an Edit in Place jquery plugin which needs to post the data to a script that will do the actual database update. The URL to this update script is easily viewable in the html source as well as with Firebug, so I need to add some sort of authentication check before the update is processed. This is of course so ...
You're correct in your approach to use session data for authentication when processing the update via your PHP script. Here’s a more structured way to enhance the security of your update process: 1. **Use Sessions for Authentication**: Since you can access session information in your update script, the best practic...
31,570
[ { "from": "human", "value": "I'm using an Edit in Place jquery plugin which needs to post the data to a script that will do the actual database update.\nThe URL to this update script is easily viewable in the html source as well as with Firebug, so I need to add some sort of authentication check before the ...
I can't seem to get Javascript debugging working for my ASP.NET MVC application even though I can for a traditional ASP.NET WebForm app. I have followed the steps for unchecking the 'Disable Script Debugging' boxes for both IE and other. when I add a simple function to display an alert in both the site.master and any c...
Debugging JavaScript in an ASP.NET MVC application should be quite similar to debugging JavaScript in a WebForms application. Since you are using Visual Studio Web Developer Express 2008, here are some steps and tips to help you troubleshoot and ensure that JavaScript debugging works correctly: ### 1. **Check Your Jav...
31,989
[ { "from": "human", "value": "I can't seem to get Javascript debugging working for my ASP.NET MVC application even though I can for a traditional ASP.NET WebForm app.\nI have followed the steps for unchecking the 'Disable Script Debugging' boxes for both IE and other.\nwhen I add a simple function to display...
What happens if the browser receives a redirect response to an ajax request?
When a browser receives a redirect response (HTTP status codes like 301, 302, 303, 307, or 308) to an AJAX request, the behavior can vary depending on the specifics of the request and the HTTP status code: 1. **302 and 303 Redirects**: Typically, if the server responds with a 302 or 303 redirect, the browser will auto...
35,466
[ { "from": "human", "value": "What happens if the browser receives a redirect response to an ajax request?\n" }, { "from": "gpt", "value": "When a browser receives a redirect response (HTTP status codes like 301, 302, 303, 307, or 308) to an AJAX request, the behavior can vary depending on the sp...
What is the best way to set the time on a remote machine remotely? The machine is running Windows XP and is receiving the new time through a web service call. The goal is to keep the remote machines in synch with the server. The system is locked down so that our web service is the only access, so I cannot use a time...
To set the time on a remote machine running Windows XP using a web service call, you'll need to implement a few steps to ensure that the time synchronization occurs effectively, given the constraints you've outlined. Here’s a possible approach: ### Step-by-Step Approach: 1. **Web Service for Time Retrieval**: - En...
33,586
[ { "from": "human", "value": "What is the best way to set the time on a remote machine remotely? The machine is running Windows XP and is receiving the new time through a web service call. The goal is to keep the remote machines in synch with the server. The system is locked down so that our web service i...
Let's have a list of some good interview questions for SharePoint developers. Please provide one question per entry, and if possible, the answers. Also, please feel free to suggest corrections if the provided answers are wrong. I will go first: Q: How does SharePoint store pages? A: How-to-locate-sharepoint-document-l...
Here’s a list of interview questions for SharePoint developers, along with their corresponding answers: 1. **Q: How does SharePoint store pages?** **A:** SharePoint stores pages as content within its content database. Pages can be stored as list items in the Site Pages or Pages library and can be represented as HTM...
28,002
[ { "from": "human", "value": "Let's have a list of some good interview questions for SharePoint developers. Please provide one question per entry, and if possible, the answers.\nAlso, please feel free to suggest corrections if the provided answers are wrong.\nI will go first: \nQ: How does SharePoint store p...
How do you programmatically eject(safely remove) an USB mass storage device in Windows (XP)?
Ejecting a USB mass storage device programmatically in Windows XP can be achieved using the Windows API. Below is a guide on how to safely remove a USB device using C++. This process involves using specific API functions like `CreateFile`, `DeviceIoControl`, and `CloseHandle`. ### Prerequisites 1. **Development Envir...
30,312
[ { "from": "human", "value": "How do you programmatically eject(safely remove) an USB mass storage device in Windows (XP)?\n" }, { "from": "gpt", "value": "Ejecting a USB mass storage device programmatically in Windows XP can be achieved using the Windows API. Below is a guide on how to safely re...
Is there anything in Visual Studio that will report memory leaks like Codeguard? eg: Error 00001. 0x300010 (Thread 0x0FA4): Resource leak: The object (0xC65D84) was never deleted The object (0x00C65D84) [size: 4 bytes] was created with new | element2.cpp line 3: | #include "element2.h" | |>CS225::Element2::Element2(i...
Visual Studio doesn't have a built-in tool exactly like CodeGuard for detecting memory leaks, but it does provide several options and tools that can help you identify and diagnose memory leaks in your application. ### 1. **Visual Studio Debugger** The Visual Studio debugger can help you find memory leaks, especially ...
34,464
[ { "from": "human", "value": "Is there anything in Visual Studio that will report memory leaks like Codeguard?\neg:\nError 00001. 0x300010 (Thread 0x0FA4):\nResource leak: The object (0xC65D84) was never deleted\n\nThe object (0x00C65D84) [size: 4 bytes] was created with new\n| element2.cpp line 3:\n| #inclu...
I'm developing an application that is so far using HttpListener to provide a small standalone http server. However, I've recently discovered that HttpListener needs to be run as Administrator, which is not always going to be possible. What would the best alternative be? I need http GET and POST, both of which are not s...
If you're looking for a lightweight alternative to `HttpListener` that does not require Administrator privileges, you have several good options that can provide similar functionality for handling HTTP requests (GET and POST) in .NET. Here are some alternatives: ### 1. **Kestrel** Kestrel is a cross-platform web server...
33,961
[ { "from": "human", "value": "I'm developing an application that is so far using HttpListener to provide a small standalone http server. However, I've recently discovered that HttpListener needs to be run as Administrator, which is not always going to be possible.\nWhat would the best alternative be? I need ...
I need to generate random numbers within a specified interval, [max;min]. Also, the random numbers should be uniformly distributed over the interval, not located to a particular point. Currenly I am generating as: for(int i=0; i<6; i++) { DWORD random = rand()%(max-min+1) + min; } From my tests, random numbers are...
It looks like you're encountering issues with the `rand()` function, which can lead to a biased distribution of random numbers, especially when you're generating numbers in a larger range. The `rand()` function is also limited by its `RAND_MAX` value (usually 32767), which can introduce additional biases when trying to...
35,295
[ { "from": "human", "value": "I need to generate random numbers within a specified interval, [max;min].\nAlso, the random numbers should be uniformly distributed over the interval, not located to a particular point.\nCurrenly I am generating as:\nfor(int i=0; i<6; i++)\n{\n DWORD random = rand()%(max-min+...
I am showing an addressbook view to the user and letting them click on a contact and select a phone number. If they select a phone number, I want to get the phone number as an integer and the contact's name as an NSString. I've tried doing it with the following code: //printf("%s\n",[[(NSArray *)ABMultiValueCopyA...
To retrieve the phone number as a string and the contact's name from the ABPeoplePickerNavigationController, you can follow these steps to handle the data more efficiently. 1. **Retrieve the Phone Number**: You will need to obtain the phone number from the `ABMultiValue` of the selected contact. This can be done by g...
34,605
[ { "from": "human", "value": "I am showing an addressbook view to the user and letting them click on a contact and select a phone number. If they select a phone number, I want to get the phone number as an integer and the contact's name as an NSString. \nI've tried doing it with the following code: \n //p...
How do I multiply the values of a multi-dimensional array with weights and sum up the results into a new array in PHP or in general? The boring way looks like this: $weights = array(0.25, 0.4, 0.2, 0.15); $values = array ( array(5,10,15), array(20,25,30), array(35,4...
Yes, there are more elegant solutions to multiply the values of a multi-dimensional array by weights and sum them up. You can use built-in functions, such as `array_reduce` or even higher-order functions like `array_map` with anonymous functions. Here's how you can accomplish this in a cleaner way: ### Using `array_re...
28,723
[ { "from": "human", "value": "How do I multiply the values of a multi-dimensional array with weights and sum up the results into a new array in PHP or in general?\nThe boring way looks like this:\n$weights = array(0.25, 0.4, 0.2, 0.15);\n$values = array\n ( \n array(5,10,15), \n ...
If I have an object in a layout in Flex what is a good way to 'break it out' of that layout to be able to animate it. For instance I have an image and a caption arranged at an angle. I want to make the image 'zoom out' slightly when the mouse rolls over it. Since its in a layout container is active if I were to resize ...
When working with Flex layouts, especially when you want to animate an object without affecting the layout of other components, there are a few strategies you can consider: 1. **Use a separate layer for animation**: Create a separate container (like a `Canvas` or `Group`) specifically for the animated object. This way...
30,642
[ { "from": "human", "value": "If I have an object in a layout in Flex what is a good way to 'break it out' of that layout to be able to animate it.\nFor instance I have an image and a caption arranged at an angle. I want to make the image 'zoom out' slightly when the mouse rolls over it. Since its in a layou...
I know that python has a len() function that is used to determine the size of a string, but I was wondering why it's not a method of the string object?
The `len()` function in Python is a built-in function that can be used to determine the length of various types of objects, including strings, lists, tuples, and more. The design choice for `len()` to be a standalone function rather than a method of the string object itself can be attributed to a few reasons: 1. **Con...
35,046
[ { "from": "human", "value": "I know that python has a len() function that is used to determine the size of a string, but I was wondering why it's not a method of the string object?\n" }, { "from": "gpt", "value": "The `len()` function in Python is a built-in function that can be used to determin...
Our company is looking to integrate invoices into a new system we are developing. We require a solution to create a layout of the invoice and then convert to pdf. We have considered just laying out the invoice in html/css then converting to pdf. We have also considered using SVG->PDf conversion. Both of these solution...
For your project to integrate invoices into a new system with a focus on an open-source Linux solution, here are a few approaches and technologies you can consider: ### 1. **HTML/CSS to PDF Conversion** Using HTML/CSS to design your invoices is a great approach because it allows for flexibility and ease of maintenanc...
30,652
[ { "from": "human", "value": "Our company is looking to integrate invoices into a new system we are developing.\nWe require a solution to create a layout of the invoice and then convert to pdf.\nWe have considered just laying out the invoice in html/css then converting to pdf. \nWe have also considered using...
I extracted the xampp package xampp-linux-1.6.7 on a Ubuntu 8.10 system and followed the instuctions from mod_wsgi documentation. I get the error below: ravi@Ibex:~/mod_wsgi-2.3$ ./configure --with-apxs=/opt/lampp/bin/apxs checking Apache version... cannot open /opt/lampp/build/config_vars.mk: No such file or directo...
It looks like you encountered an issue with mod_wsgi when trying to configure it with XAMPP on your Ubuntu system. The error message indicates that the `config_vars.mk` file is missing, which is typically required by the `apxs` tool to build and install modules. As you mentioned in your solution, the root of the probl...
32,380
[ { "from": "human", "value": "I extracted the xampp package xampp-linux-1.6.7 on a Ubuntu 8.10 system and followed the instuctions from mod_wsgi documentation. I get the error below:\nravi@Ibex:~/mod_wsgi-2.3$ ./configure --with-apxs=/opt/lampp/bin/apxs \nchecking Apache version... cannot open /opt/lampp/bu...
I have a few questions related: 1) Is possible to make my program change filetype association but only when is running? Do you see anything wrong with this behavior? 2) The other option that I'm seeing is to let users decide to open with my application or restore default association ... something like: "capture all .la...
### 1. Changing File Type Associations at Runtime **Is it possible?** Yes, it is possible for a program to change file type associations dynamically while it's running, but it typically requires administrative privileges and may involve modifying system registry settings (on Windows) or similar configuration files on ...
35,467
[ { "from": "human", "value": "I have a few questions related:\n1) Is possible to make my program change filetype association but only when is running? Do you see anything wrong with this behavior?\n2) The other option that I'm seeing is to let users decide to open with my application or restore default assoc...
When reading about SQL Injection and XSS i was wondering if you guys have a single string that could be used to identify those vulnerabilities and others. A string that could be thrown into a website database to black box check if that field is safe or not. (going to do a large test on a few inhouse tools) Rough exampl...
When testing for SQL Injection (SQLi) and Cross-Site Scripting (XSS) vulnerabilities, it’s important to use a variety of payloads. Below are some examples of common test strings that can be used for SQLi and XSS testing: ### SQL Injection Payloads 1. **Basic Boolean-based SQLi:** ```sql ' OR '1'='1 ``` 2. **...
32,408
[ { "from": "human", "value": "When reading about SQL Injection and XSS i was wondering if you guys have a single string that could be used to identify those vulnerabilities and others.\nA string that could be thrown into a website database to black box check if that field is safe or not. (going to do a large...
Can you please let me know the SQL to split date ranges when they overlap? Data (sample data with a date range and possibly other columns): Col1 FromDate ToDate 1. 1 1/1/2008 31/12/2010 2. 1 1/1/2009 31/12/2012 3. 1 1/1/2009 31/12/2014 Output: Col1 From Date ToDate 1. 1 1/1/2008 31/12/2008 (fro...
To split overlapping date ranges in SQL, you'll need to approach the problem step by step. The strategy is to identify overlapping intervals and then create non-overlapping ranges from them. Here's a basic SQL solution assuming you are using a database that supports common table expressions (CTEs) and recursive querie...
30,598
[ { "from": "human", "value": "Can you please let me know the SQL to split date ranges when they overlap?\nData (sample data with a date range and possibly other columns):\n Col1 FromDate ToDate\n 1. 1 1/1/2008 31/12/2010\n 2. 1 1/1/2009 31/12/2012\n 3. 1 1/1/2009 31/12/2014\n\nOutput:\n Col1 F...
I've been driving myself crazy trying to get the Entity Framework to work as expected (or at least as I expect) in an ASP.NET environment, specifically dealing with objects belonging to different contexts when attempting to save to the database. What are the best practices when dealing with the Entity Framework and ASP...
When working with Entity Framework (EF) in an ASP.NET environment, particularly with multiple contexts and object tracking, there are several best practices you can follow to ensure efficient and effective data handling. Below are key practices to consider: ### 1. **Use a Single DbContext per Request** In an ASP.NET ...
31,231
[ { "from": "human", "value": "I've been driving myself crazy trying to get the Entity Framework to work as expected (or at least as I expect) in an ASP.NET environment, specifically dealing with objects belonging to different contexts when attempting to save to the database.\nWhat are the best practices when...
Let's say I have an int with the value of 1. How can I convert that int to a zero padded string, such as 00000001?
You can convert an integer to a zero-padded string in Python using the `str.zfill()` method or formatted string literals (f-strings) or the `format()` function. Below are a few examples: 1. **Using `str.zfill()`**: ```python number = 1 padded_string = str(number).zfill(8) print(padded_string) # Output: 00000001 ``` ...
35,911
[ { "from": "human", "value": "Let's say I have an int with the value of 1. How can I convert that int to a zero padded string, such as 00000001?\n" }, { "from": "gpt", "value": "You can convert an integer to a zero-padded string in Python using the `str.zfill()` method or formatted string literal...
I'm trying to disable a button when a user submits a payment form and the code to post the form is causing a double post in firefox. This problem does not occur when the code is removed, and does not occur in any browser other than firefox. Any idea how to prevent the double post here? System.Text.StringBuilder sb = n...
It appears that the double post issue you're experiencing in Firefox may be related to the way that the button's click event is being handled when it is disabled. When you disable the button immediately in the click handler, the form submission can still occur if the click event is triggered before the disabling takes ...
33,767
[ { "from": "human", "value": "I'm trying to disable a button when a user submits a payment form and the code to post the form is causing a double post in firefox. \nThis problem does not occur when the code is removed, and does not occur in any browser other than firefox.\nAny idea how to prevent the double ...
I have a simple application, which should send a single byte to a serial port once a minute. But sometimes, from some strange reason, it freezes somewhere in the WriteFile() function. Both sw and hw flow controls are turned off. I've googled some stuff about pending read operations performed from another threads, but I...
It sounds like you're experiencing a frustrating issue with the `WriteFile()` function in your serial communication application. Here are several things you could check and potential solutions to help you diagnose and resolve the freezing problem: 1. **Check for Pending IO Operations**: Even if your application runs o...
32,975
[ { "from": "human", "value": "I have a simple application, which should send a single byte to a serial port once a minute. But sometimes, from some strange reason, it freezes somewhere in the WriteFile() function. Both sw and hw flow controls are turned off. I've googled some stuff about pending read operati...
Reading Paul Graham's essays on programming languages one would think that Lisp macros are the only way to go. As a busy developer, working on other platforms, I have not had the privilege of using Lisp macros. As someone who wants to understand the buzz, please explain what makes this feature so powerful. Please also ...
Lisp macros are often celebrated for their power and flexibility in manipulating code as data, thanks to Lisp’s homoiconic nature, meaning that code is represented in the same structure as data. This allows developers to write code that can generate and transform other code at compile-time, enabling a range of sophisti...
32,137
[ { "from": "human", "value": "Reading Paul Graham's essays on programming languages one would think that Lisp macros are the only way to go. As a busy developer, working on other platforms, I have not had the privilege of using Lisp macros. As someone who wants to understand the buzz, please explain what mak...
I came across the function InterlockedExchange and was wondering when I should use this function. In my opinion, setting a 32 Bit value on an x86 processor should always be atomic? In the case where I want to use the function, the new value does not depend on the old value (it is not an increment operation). Could you...
The `InterlockedExchange` function is a part of the Windows API and is used for performing atomic operations on variables. Even though setting a 32-bit value might seem atomic on an x86 processor, it is important to understand that atomicity in concurrent programming often extends beyond just the operation itself—it al...
32,691
[ { "from": "human", "value": "I came across the function InterlockedExchange and was wondering when I should use this function. In my opinion, setting a 32 Bit value on an x86 processor should always be atomic? \nIn the case where I want to use the function, the new value does not depend on the old value (it...
I'm looking for a reliable, implementation-independent way to clone an entire Document. The Javadocs specifically say that calling cloneNode on a Document is implementation-specific. I've tried passing the Document through a no-op Transformer, but the resulting Node has no owner Document. I could create a new Documen...
Cloning a `Document` in a way that is reliable and independent of the specific XML implementation can be tricky, especially when you're limited to an older version of Java like 1.4.2. Since cloning a `Document` directly using `cloneNode` is not a viable option due to its implementation-specific nature, here are a coupl...
34,450
[ { "from": "human", "value": "I'm looking for a reliable, implementation-independent way to clone an entire Document. The Javadocs specifically say that calling cloneNode on a Document is implementation-specific. I've tried passing the Document through a no-op Transformer, but the resulting Node has no own...
At the moment, I'm creating an XML file in Java and displaying it in a JSP page by transforming it with XSL/XSLT. Now I need to take that XML file and display the same information in a PDF. Is there a way I can do this by using some kind of XSL file? I've seen the iText Java-PDF library, but I can't find any way to use...
To generate a PDF from XML using XSLT, you can use a combination of XSLT transformation and the iText library. However, iText does not directly support transformation from XML using XSLT out of the box, but you can achieve this by first transforming your XML into a format that iText can work with (usually HTML or a pla...
20,614
[ { "from": "human", "value": "At the moment, I'm creating an XML file in Java and displaying it in a JSP page by transforming it with XSL/XSLT. Now I need to take that XML file and display the same information in a PDF. Is there a way I can do this by using some kind of XSL file?\nI've seen the iText Java-PD...
I'm starting a Wordpress Blog that will have adult content on it, so I'll need a first-time-only splash page in Wordpress. The first-time-only issue, I can fix with a cookie (although I am aware that not everyone has cookies enabled) What I could do is, create a script that loads another page if a cookie isn't present...
Creating a splash page with a lightbox effect for adult content is a common practice and can be an effective way to ensure visitors are aware of the nature of your site before they proceed. Here's a structured approach to implementing a lightbox splash page that gives users the option to stay or leave: ### Overview of...
29,636
[ { "from": "human", "value": "I'm starting a Wordpress Blog that will have adult content on it, so I'll need a first-time-only splash page in Wordpress. The first-time-only issue, I can fix with a cookie (although I am aware that not everyone has cookies enabled) \nWhat I could do is, create a script that lo...
I've got a java server (not web based, more like a big, many-threaded standalone application) that needs to talk to a MS SQL Server database. I just worked on a different project that ported a home-grown O/R layer from oracle to SQL Server, and it ran into significant problems because of too many oracle assumptions (l...
When it comes to integrating a Java application with Microsoft SQL Server, especially in a multi-threaded environment, using the right Object-Relational Mapping (ORM) framework can make a significant difference. Here are some popular ORM frameworks you might consider, including their features and how they handle SQL Se...
31,171
[ { "from": "human", "value": "I've got a java server (not web based, more like a big, many-threaded standalone application) that needs to talk to a MS SQL Server database. \nI just worked on a different project that ported a home-grown O/R layer from oracle to SQL Server, and it ran into significant problems...
We are repurposing an application server running WebSphere 6.0.2.23. I would like to rename the various application server to better reflect its new role. How can you rename an application server? It seems like wsadmin can do it, but I'm struggling with the object hierarchy.
Renaming an application server in WebSphere Application Server (WAS), especially in an older version like 6.0.2.23, can be a bit challenging due to the object hierarchy. However, you can achieve this using the `wsadmin` scripting tool, which provides the ability to manage WebSphere resources through Jython (or Jacl) sc...
33,390
[ { "from": "human", "value": "We are repurposing an application server running WebSphere 6.0.2.23. I would like to rename the various application server to better reflect its new role. \nHow can you rename an application server? \nIt seems like wsadmin can do it, but I'm struggling with the object hierarch...
I'm sure it's just simple html/css but I don't know what to call the bar (googling horizontal bar html always results in a horizontal rule). http://jquery.com/ has one - the grayish bar the runs across the top separating the menu from the content of the page. I'd love to make one of my own.
The element you're referring to is often called a "horizontal divider," "divider bar," or simply a "top border." In HTML and CSS, you can create a similar effect using a `<div>` element styled with CSS. Below, I will show you how to create a simple horizontal bar to separate the menu from the content. Here's a basic e...
34,680
[ { "from": "human", "value": "I'm sure it's just simple html/css but I don't know what to call the bar (googling horizontal bar html always results in a horizontal rule).\nhttp://jquery.com/ has one - the grayish bar the runs across the top separating the menu from the content of the page. I'd love to make ...
I'm trying to squeeze some more performance out of my rendering pipeline. The (by far) slowest part is performing a java.awt.imaging.LookupOp on a large image. The image size is about 2048x2048. I have figured out that having the filter done along with the drawing operation is much faster than calling the filter met...
Optimizing the `LookupOp` operation for your rendering pipeline involves several approaches. Here are some tips and techniques that can help improve the performance of your image processing, especially when dealing with large images like 2048x2048: ### 1. Precompute LUT Instead of recalculating the LUT each time in th...
30,360
[ { "from": "human", "value": "I'm trying to squeeze some more performance out of my rendering pipeline. The (by far) slowest part is performing a java.awt.imaging.LookupOp on a large image. \nThe image size is about 2048x2048.\nI have figured out that having the filter done along with the drawing operation...
The MSDN documentation is (somewhat) clear about the following two facts about GDI Pens: A Cosmetic pen (create via CreatePen or ExtCreatePen w/ PS_COSMETIC) must be 1 unit wide (well, <= 1, but let's not go there). A Geometric (ExtCreatePen w/ PS_GEOMETRIC) pen must solid (PS_SOLID only, no PS_DASH, etc). They can, ...
When working with GDI (Graphics Device Interface) in Windows, it's essential to understand the differences and intended usage of cosmetic and geometric pens. The rules you mentioned regarding the restrictions on pen width and styles are indeed part of GDI’s design to ensure predictable rendering behavior. ### Cosmetic...
33,571
[ { "from": "human", "value": "The MSDN documentation is (somewhat) clear about the following two facts about GDI Pens:\n\nA Cosmetic pen (create via CreatePen or ExtCreatePen w/ PS_COSMETIC) must be 1 unit wide (well, <= 1, but let's not go there).\nA Geometric (ExtCreatePen w/ PS_GEOMETRIC) pen must solid ...
I have a table of 155K records. I can scroll only 65K records in combo box of a form having recordsource with query or sql, selecting three fields from that table. Why it does not list all 155K records even the query, which I am using as recordsource, shows all records outside of the form.
The limitation you are experiencing with the combo box displaying only 65,000 records likely stems from several factors related to how the combo box is configured and how data is handled in your form. Here are some potential reasons and solutions: 1. **Combo Box Limitations**: - Many combo box controls have inheren...
34,449
[ { "from": "human", "value": "I have a table of 155K records. I can scroll only 65K records in combo box of a form having recordsource with query or sql, selecting three fields from that table. Why it does not list all 155K records even the query, which I am using as recordsource, shows all records outside ...
When does java let go of a connections to a URL? I don't see a close() method on either URL or URLConnection so does it free up the connection as soon as the request finishes? I'm mainly asking to see if I need to do any clean up in an exception handler. try { URL url = new URL("http://foo.bar"); URLConnection conn...
In Java, when you open a connection using `URLConnection`, it's important to note that resources associated with that connection may not be released immediately after your code block completes. The `URLConnection` class does not have a `close()` method because the connection is managed by the underlying protocol implem...
34,668
[ { "from": "human", "value": "When does java let go of a connections to a URL? I don't see a close() method on either URL or URLConnection so does it free up the connection as soon as the request finishes? I'm mainly asking to see if I need to do any clean up in an exception handler.\ntry {\n URL url = new ...
I have a user control where the XAML of the control can bind to the appropriate properties from the parent's data context like normal (the data context propagates in xaml). For example, I have a window whose DataContext I am setting to ObjectA for example. My user control within the window is then try to access the pr...
When dealing with user controls in WPF, it's important to ensure that the data context is properly set up and accessible in both XAML and code-behind. In your case, you mentioned that the user control can see the `DataContext` in XAML but not in the code-behind. This is a common issue, and it can usually be addressed b...
33,917
[ { "from": "human", "value": "I have a user control where the XAML of the control can bind to the appropriate properties from the parent's data context like normal (the data context propagates in xaml). \nFor example, I have a window whose DataContext I am setting to ObjectA for example. My user control with...
Without using Javascript, is there a way to make a CSS property toggle on and off through nested elements. The problem I'm trying to solve is that I have a number of tags and classes which make some text italic (<em>, <blockquote>, <cite>, <q>, <dfn>, and some other classes), and when one of these is inside another one...
CSS alone does not provide a direct way to toggle styles based on nested elements in the way you're trying to achieve. However, you can achieve a clean solution by leveraging the concept of `:not()` and a single rule to avoid the overly complicated listing of every permutation. Here's a way you can structure your CSS ...
31,426
[ { "from": "human", "value": "Without using Javascript, is there a way to make a CSS property toggle on and off through nested elements.\nThe problem I'm trying to solve is that I have a number of tags and classes which make some text italic (<em>, <blockquote>, <cite>, <q>, <dfn>, and some other classes), a...
According to spec, only the BODY and FRAMESET elements provide an "onload" event to attach to, but I would like to know when a dynamically-created DOM element has been added to the DOM in JavaScript. The super-naive heuristics I am currently using, which work, are as follows: Traverse the parentNode property of the el...
Your approach of checking the `parentNode` and using a timeout to retry until the element is attached to the DOM is a practical solution, albeit a bit unconventional. However, there are better, more reliable methods for detecting when a dynamically created element is added to the DOM that are more aligned with modern J...
34,024
[ { "from": "human", "value": "According to spec, only the BODY and FRAMESET elements provide an \"onload\" event to attach to, but I would like to know when a dynamically-created DOM element has been added to the DOM in JavaScript.\nThe super-naive heuristics I am currently using, which work, are as follows:...
In .Net, I found this great library, HtmlAgilityPack that allows you to easily parse non-well-formed HTML using XPath. I've used this for a couple years in my .Net sites, but I've had to settle for more painful libraries for my Python, Ruby and other projects. Is anyone aware of similar libraries for other languages...
Yes, there are several libraries in various programming languages that can help you parse HTML, similar to HtmlAgilityPack for .NET. Here are some popular options: ### Python 1. **Beautiful Soup**: A widely used library that provides simple methods for navigating and manipulating HTML and XML documents. It can handle ...
33,361
[ { "from": "human", "value": "In .Net, I found this great library, HtmlAgilityPack that allows you to easily parse non-well-formed HTML using XPath. I've used this for a couple years in my .Net sites, but I've had to settle for more painful libraries for my Python, Ruby and other projects. Is anyone aware...
Using MVC with an observer pattern, if a user action requires polling a device (such as a camera) for data, should the polling be done in the Controller and the result passed off the Model or should a request be sent to the Model and the Model itself performs the polling. This question is my attempt to reconcile everyt...
Your question about whether polling a device (like a camera) should be handled in the Controller or the Model within the MVC architecture is indeed a nuanced topic and can depend on various factors including the specific requirements of your application, design principles, and personal preference. However, we can explo...
33,053
[ { "from": "human", "value": "Using MVC with an observer pattern, if a user action requires polling a device (such as a camera) for data, should the polling be done in the Controller and the result passed off the Model or should a request be sent to the Model and the Model itself performs the polling.\nThis ...
I have a list of integers in C#. I wish to remove duplicates. In C++ I would run it through the std::sort and then std::unique algorithms for a very efficient way of obtaining the unique list. What's the best way to do the same thing in C#? In other words, I'm looking for a more elegant way to do the following code: ...
In C#, you can achieve the same goal of removing duplicates from a list of integers in a more elegant and concise way using the `HashSet<int>` collection or by utilizing LINQ (Language Integrated Query). Below are a couple of methods demonstrating both approaches. ### Using `HashSet<int>` The `HashSet<int>` collectio...
35,985
[ { "from": "human", "value": "I have a list of integers in C#. I wish to remove duplicates. \nIn C++ I would run it through the std::sort and then std::unique algorithms for a very efficient way of obtaining the unique list.\nWhat's the best way to do the same thing in C#? In other words, I'm looking for a m...
I find that whenever I begin writing an app in Java/C#, things start off good, but over time, as the app becomes more complex, it just gets more and more complicated. I've become aware of the fact that I'm not very good at design and high level architecture. All my classes become fairly strongly coupled and the desig...
Improving your high-level design and architecture skills is a valuable endeavor, and it's great that you're seeking resources and techniques to enhance your capabilities. Here are several strategies, books, and concepts to help you become a better software engineer: ### 1. **Understand Software Design Principles** ...
31,490
[ { "from": "human", "value": "I find that whenever I begin writing an app in Java/C#, things start off good, but over time, as the app becomes more complex, it just gets more and more complicated. I've become aware of the fact that I'm not very good at design and high level architecture. All my classes bec...
Some of the answers to a question I had about redirect_to made me think about some other questions. Basically I'm writing a blog application using Rails 2.1. I've been trying to do most of it myself (as I know a bit of rails), but with reference to tutorials and references on the internet when I need it. I managed to g...
In a typical Rails application, it's a common practice to have a separate controller for each model, especially when you have a resource like comments that can be associated with another resource, such as posts. While it's possible to manage comments directly within the posts controller, creating a separate `CommentsCo...
31,482
[ { "from": "human", "value": "Some of the answers to a question I had about redirect_to made me think about some other questions.\nBasically I'm writing a blog application using Rails 2.1. I've been trying to do most of it myself (as I know a bit of rails), but with reference to tutorials and references on t...
When I see Lua, the only thing I ever read is "great for embedding", "fast", "lightweight" and more often than anything else: "World of Warcraft" or in short "WoW". Why is it limited to embedding the whole thing into another application? Why not write general-purpose scripts like you do with Python or Perl? Lua seems t...
Lua is indeed an excellent language in many respects, particularly for its speed, lightweight nature, and flexibility. However, its usage patterns and the reasons you see it primarily in the context of embedding and game development (like in World of Warcraft) can be attributed to several factors: 1. **Design Philosop...
33,821
[ { "from": "human", "value": "When I see Lua, the only thing I ever read is \"great for embedding\", \"fast\", \"lightweight\" and more often than anything else: \"World of Warcraft\" or in short \"WoW\".\nWhy is it limited to embedding the whole thing into another application? Why not write general-purpose ...
I’ve been asked if we can optionally “single-instance” our web portal. See this post on Hanselman's blog for the same idea in a WinForms app. Suppose we have 2 shortcuts on the same client machine: http://MyServer/MyWebPortal/Default.aspx?user=username&document=Foo http://MyServer/MyWebPortal/Default.aspx?user=usernam...
Your approach to managing a "single-instance" web portal is creative, but using polling with a Timer can indeed lead to a suboptimal user experience due to frequent postbacks. Instead of polling, consider a more efficient solution that utilizes browser storage and JavaScript for inter-window communication. Here’s a pot...
31,485
[ { "from": "human", "value": "I’ve been asked if we can optionally “single-instance” our web portal. See\nthis post on Hanselman's blog for the same idea in a WinForms app.\nSuppose we have 2 shortcuts on the same client machine:\nhttp://MyServer/MyWebPortal/Default.aspx?user=username&document=Foo\nhttp://M...
I have the following snippet in one of my html pages : <div class="inputboximage"> <div class="value2"> <input name='address1' value='Somewhere' type="text" size="26" maxlength="40" /> <br /> </div> </div> My problem is that I need the inputboximage background to change when I click in the address1 t...
Yes, you can modify your script to traverse the DOM tree upwards until it finds a parent with the class `inputboximage` or `inputboximageLarge`. Additionally, you can set a different background image based on which class is found. Here's how you can do it using jQuery: ```html <script src="https://ajax.googleapis.com/...
31,299
[ { "from": "human", "value": "I have the following snippet in one of my html pages :\n<div class=\"inputboximage\">\n <div class=\"value2\">\n <input name='address1' value='Somewhere' type=\"text\" size=\"26\" maxlength=\"40\" />\n <br />\n\n </div>\n</div>\n\nMy problem is that I need the input...
I need advice for rendering an undirected graph with 178,000 nodes and 500,000 edges. I've tried Neato, Tulip, and Cytoscape. Neato doesn't even come remotely close, and Tulip and Cytoscape claim they can handle it but don't seem to be able to. (Tulip does nothing and Cytoscape claims to be working, and then just st...
Rendering such a large undirected graph can be challenging, especially when you want a visually appealing layout in vector format. Here are some strategies and tools you might consider: ### 1. **Graph Layout Algorithms and Tools** If the tools you've tried aren't performing well, you might want to explore some alterna...
25,578
[ { "from": "human", "value": "I need advice for rendering an undirected graph with 178,000 nodes and 500,000 edges. I've tried Neato, Tulip, and Cytoscape. Neato doesn't even come remotely close, and Tulip and Cytoscape claim they can handle it but don't seem to be able to. (Tulip does nothing and Cytosca...
We are looking to implement a rich-text box in an ASP.NET application and our requirements are specific to using the "Track Changes" features of Microsoft Word. The closest thing we found in the RadEditor by Telerik. This is a nice control that has a "Track Changes" button and will give you the ability to track the c...
Implementing a rich-text editor with comprehensive "Track Changes" functionality akin to Microsoft Word in an ASP.NET application can be challenging. While the RadEditor by Telerik offers some basic tracking features, as you've noted, it may not fulfill your specific requirements regarding version comparison. Here are...
34,653
[ { "from": "human", "value": "We are looking to implement a rich-text box in an ASP.NET application and our requirements are specific to using the \"Track Changes\" features of Microsoft Word. The closest thing we found in the RadEditor by Telerik. This is a nice control that has a \"Track Changes\" button...
I have a block of code that works and I wanted to ask what exactly is happening here? Class<?> normalFormClass = null; ---added--- The wildcard "<?>" is the part that is confusing for me. Why would this be used rather than not using it (generics)?
The line of code you provided: ```java Class<?> normalFormClass = null; ``` involves a concept known as Java generics, specifically the use of a wildcard. Let's break this down: ### Explanation of the Code 1. **Class<?>**: - This syntax defines a reference of type `Class` that can represent an instance of any c...
35,237
[ { "from": "human", "value": "I have a block of code that works and I wanted to ask what exactly is happening here?\nClass<?> normalFormClass = null;\n\n---added---\nThe wildcard \"<?>\" is the part that is confusing for me. Why would this be used rather than not using it (generics)?\n" }, { "from":...
I have a local Git repository I've been developing under for a few days: it has eighteen commits so far. Tonight, I created a private Github repository I was hoping to push it to; however, when I did so, it only ended up pushing eight of the eighteen commits to Github. I deleted the Github repo and retried, with the sa...
There are several reasons why only a portion of your commits might be pushed to GitHub. Here are some common scenarios and how to troubleshoot them: 1. **Branch Mismatch**: Ensure that you are on the `master` branch (or the branch you're trying to push) when you push to GitHub. You can check this by running: ```bas...
35,576
[ { "from": "human", "value": "I have a local Git repository I've been developing under for a few days: it has eighteen commits so far. Tonight, I created a private Github repository I was hoping to push it to; however, when I did so, it only ended up pushing eight of the eighteen commits to Github. I deleted...
I have a radio button on my Windows Form. How can I determine if the CheckChanged event occurred due to a user clicking or selecting the radio button vs programatically setting the event with this.radioButtonAdd.Checked = true; I would like some code to take a different action depending on if the user clicked the but...
To differentiate between user-initiated changes and programmatic changes to a radio button's state in a Windows Forms application, you can use a flag to track whether the change is coming from the user or your code. Here's a simple example of how you might implement this: 1. Create a private boolean flag to indicate ...
35,312
[ { "from": "human", "value": "I have a radio button on my Windows Form. How can I determine if the CheckChanged event occurred due to a user clicking or selecting the radio button vs programatically setting the event with \nthis.radioButtonAdd.Checked = true;\n\nI would like some code to take a different act...
There are plenty of "heavyweight" tools such as XmlSpy, which are good for prodding around in xml docs - but often (very often in some cases!) you just want to quickly open and browse an xml doc, and have it pretty printed. Possibly with some basic search functionality (textual is probably fine). I usually use a browse...
There are several lightweight tools and applications that you can use to quickly open, browse, and pretty print XML documents without the overhead of heavyweight IDEs or XML editors. Here are some options you might consider: 1. **Notepad++ with XML Tools Plugin**: Notepad++ is a lightweight text editor that can open l...
35,497
[ { "from": "human", "value": "There are plenty of \"heavyweight\" tools such as XmlSpy, which are good for prodding around in xml docs - but often (very often in some cases!) you just want to quickly open and browse an xml doc, and have it pretty printed. Possibly with some basic search functionality (textua...
Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if and only if user has hovered over element for certain amount of time.
Yes, you can implement a hover event with a delay using JavaScript's `setTimeout` function combined with `onmouseover` and `onmouseout` events. The idea is to set a timer when the mouse enters the element and clear the timer when the mouse leaves. If the mouse stays over the element for a specified duration, your arbit...
34,774
[ { "from": "human", "value": "Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if and only if user has hovered over element for certain amount of time.\n" }, { "from": "gpt", ...
Any ideas how to stop the system bell from sounding when CTRL-A is used to select text in a Winforms application? Here's the problem. Create a Winforms project. Place a text box on the form and add the following event handler on the form to allow CTRL-A to select all the text in the textbox (no matter which control has...
To stop the system bell (or "system beep") from sounding when CTRL-A is pressed in your WinForms application, you can prevent the default behavior by handling the `KeyDown` event correctly and ensuring the event is fully consumed. The issue arises because the `KeyPreview` property may allow the form to process the key ...
30,633
[ { "from": "human", "value": "Any ideas how to stop the system bell from sounding when CTRL-A is used to select text in a Winforms application?\nHere's the problem. Create a Winforms project. Place a text box on the form and add the following event handler on the form to allow CTRL-A to select all the text i...
How to convert last 3 digits of number into 0 example 3444678 to 3444000 I can do like (int)(3444678/1000) * 1000= 3444000 But division and multiplication could be costly... Any other solution????
Yes, you can achieve this without performing division and multiplication by using a simple approach that involves type casting and addition. Here’s a method using the modulus operator and subtraction: ```python number = 3444678 # Subtract the last three digits result = number - (number % 1000) print(result) # Outpu...
37,311
[ { "from": "human", "value": "How to convert last 3 digits of number into 0\nexample 3444678 to 3444000\nI can do like \n(int)(3444678/1000) * 1000= 3444000\nBut division and multiplication could be costly...\nAny other solution????\n" }, { "from": "gpt", "value": "Yes, you can achieve this witho...
I recently found a log statement in my projects codebase that says "here i am with search parameter==>===========11/30/2008===1====00:00 AM" what guidelines do you adhere to for writing good log messages in an application?
Writing good log messages is crucial for maintaining, debugging, and monitoring applications effectively. Here are some guidelines to consider when crafting log messages: ### 1. **Clarity and Conciseness** - **Be Clear**: Use clear and descriptive language to convey the message. Avoid jargon unless it's commonly un...
30,570
[ { "from": "human", "value": "I recently found a log statement in my projects codebase that says\n\"here i am with search parameter==>===========11/30/2008===1====00:00 AM\"\nwhat guidelines do you adhere to for writing good log messages in an application?\n" }, { "from": "gpt", "value": "Writing...
According to this page, it's possible to use TClientDataset as an in-memory dataset, completely independent of any actual databases or files. It describes how to setup the dataset's table structure and how to load data into it at runtime. But when I tried to follow its instructions in D2009, step 4 (table.Open) raise...
It sounds like you're encountering a common issue when trying to use `TClientDataset` as an in-memory dataset in Delphi 2009 (D2009). The exception you're seeing, indicating that there is no provider specified, typically arises when `TClientDataset` is expected to interact with a data provider, which is not necessary f...
33,117
[ { "from": "human", "value": "According to this page, it's possible to use TClientDataset as an in-memory dataset, completely independent of any actual databases or files. It describes how to setup the dataset's table structure and how to load data into it at runtime. But when I tried to follow its instruc...
So a webapp I've been working on broke, and I made some fixes... it still crashes, but in the YSOD it shows me the old code. I'm running this from the VS 2005 IDE. It won't hit any breakpoints, and it crashes on line 249, which is clearly commented out. I've cleared out my debug/release folders and rebuilt it; restarte...
It sounds like you're experiencing a frustrating issue with your web application in Visual Studio 2005, particularly related to caching and old code still being referenced despite your efforts to rebuild. Here are several steps and troubleshooting tips you can follow to resolve this problem: 1. **Clean the Solution**:...
32,921
[ { "from": "human", "value": "So a webapp I've been working on broke, and I made some fixes... it still crashes, but in the YSOD it shows me the old code. I'm running this from the VS 2005 IDE. It won't hit any breakpoints, and it crashes on line 249, which is clearly commented out. I've cleared out my debug...
I have a swf file that is not controlled by me. The swf expects a javascript call to set some variables after initialization. The swf is embedded using the swfobject and I'm trying to call the as function right after the embed. This appears to be too soon because I get an error. Everything else should be fine since ca...
To call a function in an SWF file after it has been fully loaded and initialized, you can use the `swfobject` library's event listener or callback mechanism. This ensures that your JavaScript function call only happens once the SWF file is fully embedded and ready to be interacted with. Here is a general approach to a...
31,110
[ { "from": "human", "value": "I have a swf file that is not controlled by me. The swf expects a javascript call to set some variables after initialization. \nThe swf is embedded using the swfobject and I'm trying to call the as function right after the embed. This appears to be too soon because I get an erro...
Looking for a good choice of .NET-based Wiki Platform. Doesn't need to be Open Source, but the cheaper the better.
There are several .NET-based wiki platforms available, both open source and commercial. Here are some of the notable ones: 1. **Umbraco CMS**: - While primarily a content management system, Umbraco can be used to create a wiki-like site. It is open source and flexible, allowing for customization. You can find vario...
35,276
[ { "from": "human", "value": "Looking for a good choice of .NET-based Wiki Platform. Doesn't need to be Open Source, but the cheaper the better.\n" }, { "from": "gpt", "value": "There are several .NET-based wiki platforms available, both open source and commercial. Here are some of the notable o...
On our TFS source control server, a lot of source files are checked out by people, which are not employed any more. Is there a central way where I can undo check out on all files in TFS? I'm not even sure that they exists in Active Directory anymore.
In TFS (Team Foundation Server), you can undo checkouts for files that are checked out by users who are no longer employed. This can be particularly useful for cleaning up your source control. Below are the steps you can follow to accomplish this: ### Using Visual Studio 1. **Open Source Control Explorer**: - Open...
30,867
[ { "from": "human", "value": "On our TFS source control server, a lot of source files are checked out by people, which are not employed any more.\nIs there a central way where I can undo check out on all files in TFS?\nI'm not even sure that they exists in Active Directory anymore.\n" }, { "from": "g...
Is there a way to set "work offline" in TFS without having to try opening a solution, waiting for it to time out, and then having Visual Studio work out that it has failed? It seems a touch ridiculous that I can't just tick a box to tell it myself, seeing as I'm probably the one most qualified to know when I'm not in t...
Yes, you can set "Work Offline" in Team Foundation Server (TFS) using Visual Studio without having to open a solution and waiting for a timeout. While it might not be the most intuitive, you can do it directly from the Team Explorer window. Here’s how: 1. **Open Team Explorer**: In Visual Studio, go to `View` -> `Team...
36,344
[ { "from": "human", "value": "Is there a way to set \"work offline\" in TFS without having to try opening a solution, waiting for it to time out, and then having Visual Studio work out that it has failed?\nIt seems a touch ridiculous that I can't just tick a box to tell it myself, seeing as I'm probably the ...
When using regular expressions in Ruby, what is the difference between $1 and \1?
In Ruby, the usage of `$1` and `\1` in regular expressions has different meanings and contexts: 1. **`$1`**: This is a special variable in Ruby that contains the string matched by the first capturing group in the most recent successful pattern match. It can be used after a regular expression match to refer to the valu...
34,066
[ { "from": "human", "value": "When using regular expressions in Ruby, what is the difference between $1 and \\1?\n" }, { "from": "gpt", "value": "In Ruby, the usage of `$1` and `\\1` in regular expressions has different meanings and contexts:\n\n1. **`$1`**: This is a special variable in Ruby tha...
We have a .NET application that uses WMI to gather a wide range of information on machines throughout a network, such as reading the Win32_NTLogEvent to see if Symantec Antivirus has written anything. The queries work fine, but after repeatedly running a WMI query "Generic Failure" errors will start coming back. This...
The issues you're experiencing with WMI queries returning "Generic Failure" errors and the `WBEM_E_OUT_OF_MEMORY` (0x80041006) and `0x8007000E` (not enough storage available) errors are often indicative of resource exhaustion in the WMI subsystem. Here are several potential causes and solutions you can explore: ### 1....
33,730
[ { "from": "human", "value": "We have a .NET application that uses WMI to gather a wide range of information on machines throughout a network, such as reading the Win32_NTLogEvent to see if Symantec Antivirus has written anything. The queries work fine, but after repeatedly running a WMI query \"Generic Fai...
I have seen some gridview header freezing examples on the web but I have a special case where the gridview is in a fixed width div. The examples I tried make the header fixed but the full width of the header is shown and it overflows out of the div while the grid body has a horizontal scroll bar. I need it to: 1- Heade...
To achieve a fixed header with a horizontally scrolling GridView in a fixed-width div, while ensuring that both the header and body scroll together horizontally and the body scrolls vertically, you can use a combination of CSS and JavaScript (if necessary). Below is a simple example that demonstrates how to create this...
30,135
[ { "from": "human", "value": "I have seen some gridview header freezing examples on the web but I have a special case where the gridview is in a fixed width div. The examples I tried make the header fixed but the full width of the header is shown and it overflows out of the div while the grid body has a hori...
I'm trying to change the font in an AWT menu bar using MenuBar.setFont(). The call works for the menu bar's child menus, but the menu bar itself doesn't change font (I'm trying to make the font larger). Does anyone know whether this is possible to do? I'm using JRE 1.6 on Windows XP. Update: Changing the font does seem...
In AWT (Abstract Window Toolkit), the behavior you're observing is related to how the underlying native look-and-feel manages the font rendering for components. Specifically, the menu bar's font can be set using `MenuBar.setFont()`, but the rendering is influenced by the native system's constraints, which often leads t...
30,515
[ { "from": "human", "value": "I'm trying to change the font in an AWT menu bar using MenuBar.setFont(). The call works for the menu bar's child menus, but the menu bar itself doesn't change font (I'm trying to make the font larger).\nDoes anyone know whether this is possible to do?\nI'm using JRE 1.6 on Wind...
What is the difference between parameterizedThreadstart, Threadstart and Thread?
In C#, `ParameterizedThreadStart`, `ThreadStart`, and `Thread` are all related to creating and managing threads, but they have different roles and purposes. Here’s a breakdown of each: ### 1. `Thread` `Thread` is a class in the `System.Threading` namespace that represents a thread of execution in your application. Yo...
31,916
[ { "from": "human", "value": "What is the difference between parameterizedThreadstart, Threadstart and Thread?\n" }, { "from": "gpt", "value": "In C#, `ParameterizedThreadStart`, `ThreadStart`, and `Thread` are all related to creating and managing threads, but they have different roles and purpos...
I'm working with large numbers that I can't have rounded off. Using Lua's standard math library, there seem to be no convenient way to preserve precision past some internal limit. I also see there are several libraries that can be loaded to work with big numbers: http://oss.digirati.com.br/luabignum/ http://www.tc.u...
Yes, when it comes to handling large numbers or high-precision arithmetic in Lua, the standard math library has its limitations, primarily due to its reliance on floating-point representations which can introduce rounding errors for very large or very small numbers. To work with precise large numbers, you indeed have s...
34,945
[ { "from": "human", "value": "I'm working with large numbers that I can't have rounded off. Using Lua's standard math library, there seem to be no convenient way to preserve precision past some internal limit. I also see there are several libraries that can be loaded to work with big numbers:\n\nhttp://oss...
I am in the process of moving from VSS to SVN and I'm not sure how to share files in SVN. Basically we have the following structure in VSS $MOSS - Components - ComponentA - bin - ComponentB - bin - GAC Mirror GAC Mirror holds a shared copy of all the Dlls from the bin folders of the components ...
In SVN, the way you manage and share files is somewhat different than in VSS. SVN is designed to handle version control in a more distributed manner, and it doesn’t provide a direct way to have a shared folder like the GAC Mirror in VSS where you can simply drag and drop files. However, you can achieve similar function...
31,697
[ { "from": "human", "value": "I am in the process of moving from VSS to SVN and I'm not sure how to share files in SVN.\nBasically we have the following structure in VSS\n$MOSS\n - Components\n - ComponentA\n - bin\n - ComponentB\n - bin\n - GAC Mirror\n\nGAC Mirror holds a shared copy of a...
I'm being asked to add queryability to a database (Oracle) filled with mostly binary data. So I need to be able to query binary ranges within a blobs of a few kilobytes. I've never done this before, so I'm wondering what are some good practices and pitfalls to consider when starting a project like this. Thanks
Adding queryability to a database with mostly binary data (BLOBs) can be challenging, but it can greatly enhance the usability of your data. Below are some good practices and potential pitfalls to consider when working with Oracle databases and querying binary data: ### Good Practices 1. **Understand the Data Structu...
27,925
[ { "from": "human", "value": "I'm being asked to add queryability to a database (Oracle) filled with mostly binary data.\nSo I need to be able to query binary ranges within a blobs of a few kilobytes. I've never done this before, so I'm wondering what are some good practices and pitfalls to consider when sta...
I have a number of child tables that have a foreign key to a parent table. How do I add an entry in the parent table and get the primary key of that entry, so that I can then enter rows in the child tables that point to the entry in the parent table? I'm doing this in a MS Access Database from a C# application.
To add an entry in a parent table and retrieve the primary key of that entry in a Microsoft Access database using a C# application, you can follow these general steps: 1. **Insert the Parent Record**: Use an `INSERT` SQL statement to add a new record to your parent table. 2. **Retrieve the Primary Key**: After the in...
25,400
[ { "from": "human", "value": "I have a number of child tables that have a foreign key to a parent table.\nHow do I add an entry in the parent table and get the primary key of that entry, so that I can then enter rows in the child tables that point to the entry in the parent table?\nI'm doing this in a MS Acc...
For example, see the MySQL website. It's only going to be used to rotate through about 3-5 "ads" to noteworthy areas of the site. I'd like to have some kind of link control to backtrack to the other content (again, like the MySQL site). Google gives me a bunch of very easy to implement stuff for the rotation itself, it...
To implement a simple ad rotation with link control similar to what you described on the MySQL website, you can follow these general steps. I'll outline a basic structure using HTML, CSS, and JavaScript, along with some example code to get you started. ### Step 1: HTML Structure Create a basic HTML structure that wil...
24,431
[ { "from": "human", "value": "For example, see the MySQL website. It's only going to be used to rotate through about 3-5 \"ads\" to noteworthy areas of the site. I'd like to have some kind of link control to backtrack to the other content (again, like the MySQL site). Google gives me a bunch of very easy to ...
What do you use as a test client for your stateful web services? Is it possible to use SoapUI? Are there best practices in this area?
Yes, you can definitely use SoapUI as a test client for stateful web services. SoapUI is a popular tool for testing web services, both SOAP and RESTful APIs, and it has features that can help you manage and test stateful interactions. ### Using SoapUI for Stateful Web Services: 1. **Creating Test Cases**: In SoapUI,...
34,529
[ { "from": "human", "value": "What do you use as a test client for your stateful web services? Is it possible to use SoapUI? Are there best practices in this area?\n" }, { "from": "gpt", "value": "Yes, you can definitely use SoapUI as a test client for stateful web services. SoapUI is a popular t...
I want to develop a website in ASP classic that uses HTTP Authentication against a database or password list that is under the control of the script. Ideally, the solution should involve no components or IIS settings as the script should be runnable in a hosted environment. Any clues/code deeply appreciated.
Creating a basic HTTP Authentication in ASP Classic that checks against a database or a password list can be achieved by implementing your own authentication mechanism without relying on IIS settings or components. Below, I will outline a simple example using a database approach. In this example, I'll assume you have a...
30,974
[ { "from": "human", "value": "I want to develop a website in ASP classic that uses HTTP Authentication against a database or password list that is under the control of the script. Ideally, the solution should involve no components or IIS settings as the script should be runnable in a hosted environment.\nAny...
I have SSRS Report being accessed from a Report Server. Is there any way I can give an error message of my own, if my report fails to open there?
In SQL Server Reporting Services (SSRS), when a report fails to render or open due to an error, the default error messages can sometimes be generic and may not provide specific guidance to the user. Unfortunately, SSRS does not have built-in capabilities to customize the error messages that appear when a report fails t...
34,646
[ { "from": "human", "value": "I have SSRS Report being accessed from a Report Server. Is there any way I can give an error message of my own, if my report fails to open there? \n" }, { "from": "gpt", "value": "In SQL Server Reporting Services (SSRS), when a report fails to render or open due to a...
I am trying to do something in VisualWebDev 2008 Express that I thought would be simple, but it is not working. I want to display data from an XML file so I added the XMLDataSource to my page, pointed it to the XML file, and then added the GridView and connected it to the datasource. I am getting the following error: G...
It looks like you are encountering an issue with your `GridView` control not being able to generate columns based on the data from your XML file. This is typically due to how the data is structured in the XML file. Here's a breakdown of what's likely happening and how to resolve it: ### XML Structure Your XML file ...
33,834
[ { "from": "human", "value": "I am trying to do something in VisualWebDev 2008 Express that I thought would be simple, but it is not working. I want to display data from an XML file so I added the XMLDataSource to my page, pointed it to the XML file, and then added the GridView and connected it to the dataso...
Castle Active Record? Plain NHibernate? Subsonic? Entity? Something like Nettiers? I'd like to use one, but I don't know enough to decide. Nhibernate seems over kill and complex, but widely used. Subsonic seems neat and easy. But is it stable? I have CodeSmith, and I was pointed to Nettiers, which seems neat as wel...
Choosing an ORM (Object-Relational Mapping) tool can be a challenging decision, especially given the variety of options available. Here’s a breakdown of the ones you mentioned, along with some considerations that may help you decide which one to use. ### ORM Options 1. **Castle Active Record**: - A simple and powe...
31,634
[ { "from": "human", "value": "Castle Active Record?\nPlain NHibernate?\nSubsonic?\nEntity?\nSomething like Nettiers?\nI'd like to use one, but I don't know enough to decide. Nhibernate seems over kill and complex, but widely used. Subsonic seems neat and easy. But is it stable? I have CodeSmith, and I wa...
I am adapting a little rmi client-server application. I have written several things : HelloInterface -> A Hello World interface for RMI Server -> The server app' Client -> The client app' Nothing special, but... I have put my hands in a new RMISecurityManager, which calls a JNI method and checks the permission for a s...
You're encountering a `SecurityException` because when the RMI server starts, it tries to access resources in its initialization process. The issue arises because the `ThreadLocal` variable `user` in your `NativeRMISecurityManager` is not set for those newly created threads (like the RMI connection threads), which lead...
34,853
[ { "from": "human", "value": "I am adapting a little rmi client-server application. I have written several things :\nHelloInterface -> A Hello World interface for RMI\nServer -> The server app'\nClient -> The client app'\n\nNothing special, but... I have put my hands in a new RMISecurityManager, which calls ...
What's the best way to implement user controls that require AJAX callbacks? I want to accomplish a few things: Have events done in the browser (eg, drag and drop) trigger an AJAX notification that can raise a control event, which causes code on the page using the control to do whatever it needs to do (eg, change a va...
To achieve the objectives you've outlined for implementing user controls with AJAX callbacks while avoiding repetitive logic on the page, you can follow a structured approach using ASP.NET Web Forms or ASP.NET MVC with jQuery. Here’s a suggested methodology that allows you to create reusable user controls that handle A...
30,753
[ { "from": "human", "value": "What's the best way to implement user controls that require AJAX callbacks? \nI want to accomplish a few things:\n\nHave events done in the browser (eg, drag and drop) trigger an AJAX notification that can raise a control event, which causes code on the page using the control to...
I'm dynamically generating an asp form, and I would like to add the label and input elements inside a list. For example, I would like to end up with something like: <ul> <li><label for="input"/><input id=input"/></li> </ul> To do this, I create a Label object and a TextBox object, then assign the AssociatedControlId p...
To dynamically create a form with a list structure in ASP.NET where you can add `<label>` and `<input>` elements inside list items, you can use a combination of a `Repeater` control or a `ListView` control, and then add the `Label` and `TextBox` controls programmatically. Here’s how you can accomplish this: ### Using ...
31,256
[ { "from": "human", "value": "I'm dynamically generating an asp form, and I would like to add the label and input elements inside a list.\nFor example, I would like to end up with something like:\n<ul>\n<li><label for=\"input\"/><input id=input\"/></li>\n</ul>\n\nTo do this, I create a Label object and a Tex...
We have a CustomAction that sets some registry key HKEY LOCAL_MACHINE. This wasn't working on Vista with UAC, until we made the action "deferred". The installer worked in other cases. Anyone knows why? We are using WIX to create the installer.
When creating an installer using WiX, it's important to understand how Windows User Account Control (UAC) works, especially with operating systems like Windows Vista and later. UAC restricts access to certain areas of the system, including the HKEY_LOCAL_MACHINE registry hive, unless the application (in this case, your...
32,156
[ { "from": "human", "value": "We have a CustomAction that sets some registry key HKEY LOCAL_MACHINE. This wasn't working on Vista with UAC, until we made the action \"deferred\". The installer worked in other cases. Anyone knows why?\nWe are using WIX to create the installer.\n" }, { "from": "gpt", ...
I've been a PHP developer for many years now, with many tools under my belt; tools that I've either developed myself, or free-to-use solutions that I have learned to trust. I looked into CodeIgniter recently, and discovered that they have many classes and helper routines to aid with development, yet saw nothing in the ...
It's not uncommon for experienced developers, especially those with a strong set of tools and skills developed over years, to question the benefits of adopting a framework. Your perspective reflects a common sentiment among seasoned developers who have built their own systems and tools. Let’s explore some of the benefi...
33,875
[ { "from": "human", "value": "I've been a PHP developer for many years now, with many tools under my belt; tools that I've either developed myself, or free-to-use solutions that I have learned to trust.\nI looked into CodeIgniter recently, and discovered that they have many classes and helper routines to aid...
Is it possible to typedef long types that use templates? For example: template <typename myfloat_t> class LongClassName { // ... }; template <typename myfloat_t> typedef std::vector< boost::shared_ptr< LongClassName<myfloat_t> > > LongCollection; LongCollection<float> m_foo; This doesn't work, but is there a wa...
In C++, `typedef` cannot be directly used with templates the way you're trying to do it. However, you can achieve a similar effect using `using`, which is more flexible and is the preferred method in modern C++ (C++11 and later). Here’s how you can define your `LongCollection` using `using` with templates: ```cpp #i...
32,683
[ { "from": "human", "value": "Is it possible to typedef long types that use templates? For example:\ntemplate <typename myfloat_t>\nclass LongClassName\n{\n // ...\n};\n\ntemplate <typename myfloat_t>\ntypedef std::vector< boost::shared_ptr< LongClassName<myfloat_t> > > LongCollection;\n\nLongCollection<...
I'm making my way through the early Data Access Tutorials on Microsoft's ASP.NET website and it occurred to me that this all seems awfully similar to what I have read about separating your logic and presentation code using the MVC pattern. As a newbie I have yet to implement the MVC pattern but I'm curious as to how th...
It's great to hear that you're delving into ASP.NET and exploring data access tutorials! You're right in noticing the similarities between the concepts of data access patterns and the Model-View-Controller (MVC) design pattern. Let's clarify how they differ and how you might want to approach both in the context of web ...
32,283
[ { "from": "human", "value": "I'm making my way through the early Data Access Tutorials on Microsoft's ASP.NET website and it occurred to me that this all seems awfully similar to what I have read about separating your logic and presentation code using the MVC pattern. As a newbie I have yet to implement the...
I have a stored procedure currently executing a complicated fetch that is frequently timing out when used. The proposed solution in my department has been to simply increase the timeout time length; which I don't really want to do. I'd like to refactor this sproc, but because it's so complicated and undocumented (yay l...
Refactoring a stored procedure in SQL Server 2005, particularly one that is complex and undocumented, can be a challenging task. However, there are several strategies you can employ to help ensure that your refactoring results in the same functionality while improving performance. Here are some key strategies: ### 1. ...
30,118
[ { "from": "human", "value": "I have a stored procedure currently executing a complicated fetch that is frequently timing out when used. The proposed solution in my department has been to simply increase the timeout time length; which I don't really want to do. I'd like to refactor this sproc, but because it...
I would like to be able to dictate into my Delphi application using Microsoft Vista's speech recognition. However when attempting to dictate into a TMemo, it simply does not work. I noticed that Firefox 3.0 has the same issue and after they contacted Microsoft about the problem, they told them that they need to impleme...
Implementing support for the Text Services Framework (TSF) in a Delphi application can be quite challenging, especially if you're not familiar with COM and Windows APIs. However, it's certainly possible to enable dictation capabilities in your Delphi application, such as TMemo or TRichEdit, by using the TSF. Here are ...
30,547
[ { "from": "human", "value": "I would like to be able to dictate into my Delphi application using Microsoft Vista's speech recognition. However when attempting to dictate into a TMemo, it simply does not work. I noticed that Firefox 3.0 has the same issue and after they contacted Microsoft about the problem,...
How to optimize queries which are already written?
Optimizing existing queries can significantly improve the performance of your database operations. Here are several strategies you can employ to optimize queries that are already written: ### 1. **Understand the Query Execution Plan** - Use tools like `EXPLAIN` (or `EXPLAIN ANALYZE`) in SQL to understand how the qu...
34,349
[ { "from": "human", "value": "How to optimize queries which are already written?\n" }, { "from": "gpt", "value": "Optimizing existing queries can significantly improve the performance of your database operations. Here are several strategies you can employ to optimize queries that are already writ...
I've become very comfortable in the world of pointer-free, garbage-collected programming languages. Now I have to write a small Mac component. I've been learning Objective-C, but as I confront the possibility of dangling pointers and the need to manage retain counts, I feel disheartened. I know that Objective-C now has...
It's understandable to feel a bit overwhelmed when transitioning to a language like Objective-C, especially if you're coming from a pointer-free, garbage-collected language like Java. Fortunately, there are some approaches you can take to minimize the difficulties associated with manual memory management in Objective-C...
33,937
[ { "from": "human", "value": "I've become very comfortable in the world of pointer-free, garbage-collected programming languages. Now I have to write a small Mac component. I've been learning Objective-C, but as I confront the possibility of dangling pointers and the need to manage retain counts, I feel dish...
Does anybody use Scrum & Sprint for Infrastructure. I'm struggling with the concept of a Sprint that never finishes i.e. a Network enhancement project. Also any suggestions on how Item time can be built up to a Product Backlog, so that I can sanity check that resources are not overcommited on the sprint.
Using Scrum and Sprints for infrastructure projects is definitely possible, though it may not always fit the traditional software development approach perfectly. Here are some strategies to adapt Scrum practices to infrastructure projects like a network enhancement: ### Using Scrum for Infrastructure Projects 1. **De...
32,115
[ { "from": "human", "value": "Does anybody use Scrum & Sprint for Infrastructure.\nI'm struggling with the concept of a Sprint that never finishes i.e. a Network enhancement project.\nAlso any suggestions on how Item time can be built up to a Product Backlog, so that I can sanity check that resources are no...
I know how to add methods to the MY namesapce, but what I'd like to do is create my own namespaces. For example. My.Nation.State.City.Restraunt or whatever.
Creating custom namespaces in your code can help organize your functions, classes, and variables, making your code more manageable and preventing naming collisions. The specific method to create namespaces depends on the programming language you are using. Here are examples in a few different languages: ### In Python ...
32,534
[ { "from": "human", "value": "I know how to add methods to the MY namesapce, but what I'd like to do is create my own namespaces. For example. My.Nation.State.City.Restraunt or whatever.\n" }, { "from": "gpt", "value": "Creating custom namespaces in your code can help organize your functions, c...
I haven't been able to find an adequate answer to what exactly the following error means: java.net.SocketException: Software caused connection abort: recv failed Notes: This error is infrequent and unpredictable; although getting this error means that all future requests for URIs will also fail. The only solution tha...
The error message `java.net.SocketException: Software caused connection abort: recv failed` typically indicates that a network connection was unexpectedly closed by the operating system or the network stack on the machine. This error can arise from a variety of situations, including: 1. **Network Configuration Issues*...
27,778
[ { "from": "human", "value": "I haven't been able to find an adequate answer to what exactly the following error means:\njava.net.SocketException: Software caused connection abort: recv failed \nNotes:\n\nThis error is infrequent and unpredictable; although getting this error means that all future requests f...
I've been adding css support for handheld to my website but haven't been able to find a good tool for testing. I tried using the webdeveloper plugin for Firefox but it doesn't work for me. Maybe that is because all my css is in the html and not a seperate css file. Are there any other testing tools available aside fro...
There are several ways to test your website's CSS support for handheld devices without needing to purchase an actual handheld device. Here are some tools and methods you can try: ### 1. Browser Developer Tools Most modern browsers come with built-in developer tools that allow you to simulate various devices, including...
35,211
[ { "from": "human", "value": "I've been adding css support for handheld to my website but haven't been able to find a good tool for testing. \nI tried using the webdeveloper plugin for Firefox but it doesn't work for me. Maybe that is because all my css is in the html and not a seperate css file.\nAre there ...
Caveat: I try all the posibilities listed here: How can I ignore everything under a folder in Mercurial. None works as I hope. I want to ignore every thing under the folder test. But not ignore srcProject\test\TestManager I try syntax: glob test/** And it ignores test and srcProject\test\TestManager With: syntax: r...
To achieve the goal of ignoring everything under a specific folder (e.g., `test`) except for a specific subfolder (e.g., `srcProject/test/TestManager`), you can use Mercurial's ignore file with a combination of patterns. Here's how you can set this up in your `.hgignore` file: 1. **Ignore everything under `test` fol...
36,544
[ { "from": "human", "value": "Caveat:\nI try all the posibilities listed here: How can I ignore everything under a folder in Mercurial.\nNone works as I hope. \nI want to ignore every thing under the folder test. But not ignore srcProject\\test\\TestManager \nI try\nsyntax: glob\ntest/**\n\nAnd it ignores t...
When I publish my ASP.NET site in RELEASE mode, and set compilation debug="false", will my ASP.NET and System.Diagnostics Tracing still work?
Yes, when you publish your ASP.NET site in RELEASE mode and set `compilation debug="false"`, ASP.NET and `System.Diagnostics.Tracing` can still work, but there are some important considerations. 1. **Compilation Mode**: Setting `debug="false"` in your web.config file indicates that the application is optimized for rel...
36,342
[ { "from": "human", "value": "When I publish my ASP.NET site in RELEASE mode, and set compilation debug=\"false\", will my ASP.NET and System.Diagnostics Tracing still work?\n" }, { "from": "gpt", "value": "Yes, when you publish your ASP.NET site in RELEASE mode and set `compilation debug=\"false...
I am designing a windows service and now deploying it. I have the code: ServiceInstaller serviceInstaller1 = new ServiceInstaller(); This instantiates the object (obviously, but throws the following compile-time error: Error 1 The type 'System.Configuration.Install.ComponentInstaller' is defined in an assembly that...
The error message you're encountering indicates that your project is missing a reference to the `System.Configuration.Install` assembly, which is necessary for using classes like `ServiceInstaller`. You can fix this issue by adding the required reference to your project. Here's how to do that: ### Steps to Add Referen...
32,947
[ { "from": "human", "value": "I am designing a windows service and now deploying it.\nI have the code:\nServiceInstaller serviceInstaller1 = new ServiceInstaller();\nThis instantiates the object (obviously, but throws the following compile-time error:\nError 1 The type 'System.Configuration.Install.Compo...
<form id="frm_1" name="frm_1" target="_self" method="GET" action="local_page.php" > </form> <form id="tgt_1" name="tgt_1" target="_blank" method="POST" action="http://stackoverflow.com/" > </form> <a onclick="test(event, '1'); " href="#" >Click Here</a> <script> function test(event, id){ document.getElement...
In the provided code, the intent seems to be to submit two forms: one that targets the same page (`frm_1` which submits via `GET`) and another that targets a different page (`tgt_1` which submits via `POST` and is meant to open in a new tab). However, there are a couple of issues that need to be addressed: 1. **Submi...
34,301
[ { "from": "human", "value": "<form id=\"frm_1\" name=\"frm_1\" target=\"_self\" method=\"GET\" action=\"local_page.php\" >\n</form>\n<form id=\"tgt_1\" name=\"tgt_1\" target=\"_blank\" method=\"POST\" action=\"http://stackoverflow.com/\" >\n</form>\n<a onclick=\"test(event, '1'); \" href=\"#\" >Click Here</...
How would you go about converting a reasonably large (>300K), fairly mature C codebase to C++? The kind of C I have in mind is split into files roughly corresponding to modules (i.e. less granular than a typical OO class-based decomposition), using internal linkage in lieu private functions and data, and external linka...
Converting a large and mature C codebase into C++ is indeed a substantial task, particularly when you have a working, well-established product that must maintain its existing functionality. Your outlined strategy is a reasonable approach, but here are some additional considerations, best practices, and alternative stra...
30,014
[ { "from": "human", "value": "How would you go about converting a reasonably large (>300K), fairly mature C codebase to C++?\nThe kind of C I have in mind is split into files roughly corresponding to modules (i.e. less granular than a typical OO class-based decomposition), using internal linkage in lieu priv...
I know that you can apply CSS in order to style objects in Flex using the StyleManager: http://livedocs.adobe.com/flex/3/html/help.html?content=styles_07.html You can also load compiled CSS files (SWFs) dynamically: http://livedocs.adobe.com/flex/3/html/help.html?content=styles_10.html However, I'm dynamically creati...
Yes, there are ways to apply CSS dynamically in Flex without the need to compile them into SWFs each time they change. Here are a couple of approaches you can consider: ### 1. Load CSS Dynamically from External Files Instead of compiling your CSS into an SWF, you can keep your CSS in an external `.css` file format. Fl...
33,534
[ { "from": "human", "value": "I know that you can apply CSS in order to style objects in Flex using the StyleManager:\nhttp://livedocs.adobe.com/flex/3/html/help.html?content=styles_07.html \nYou can also load compiled CSS files (SWFs) dynamically:\nhttp://livedocs.adobe.com/flex/3/html/help.html?content=sty...
When using copy-on-write semantics to share memory among processes, how can you test if a memory page is writable or if it is marked as read-only? Can this be done by calling a specific assembler code, or reading a certain spot in memory, or through the OS's API?
To determine if a memory page is writable or marked as read-only in a system that employs copy-on-write (COW) semantics, there are a few different approaches you can take. Here are the most common methods: ### 1. Use Operating System API Many operating systems provide APIs to query the permissions of memory pages. For...
34,243
[ { "from": "human", "value": "When using copy-on-write semantics to share memory among processes, how can you test if a memory page is writable or if it is marked as read-only? Can this be done by calling a specific assembler code, or reading a certain spot in memory, or through the OS's API?\n" }, { ...
I have a factory that returns an interface FormatService: public class FormatServiceFactory { public FormatService getService() { ... } } Is it possible to mock out this factory so that it will always return a stub implementation of FormatService - FormatServiceStub in our unit tests?
Yes, you can definitely mock the `FormatServiceFactory` so that it always returns a stub implementation of `FormatService` (like `FormatServiceStub`) in your unit tests. How you accomplish this depends on the testing framework and mocking library you're using. Assuming you're using a mocking framework like Mockito in ...
34,940
[ { "from": "human", "value": "I have a factory that returns an interface FormatService: \npublic class FormatServiceFactory {\n public FormatService getService() {\n ...\n }\n}\n\nIs it possible to mock out this factory so that it will always return a stub implementation of FormatService - Form...