instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
If I wanted to find checked check boxes on an ASP.NET page I could use the following LINQ query. var checkBoxes = this.Controls .OfType<CheckBox>() .TakeWhile<CheckBox>(cb => cb.Checked); That works fine if the checkboxes are nested in the current control collection, but I'd l...
To extend the search for checked checkboxes in a recursive manner using LINQ, you'll need to use a combination of `SelectMany` and a recursive function (or a method) to flatten the control tree. LINQ itself doesn't inherently support recursion in its standard query operators, but you can achieve this through a helper m...
28,689
[ { "from": "human", "value": "If I wanted to find checked check boxes on an ASP.NET page I could use the following LINQ query.\nvar checkBoxes = this.Controls\n .OfType<CheckBox>()\n .TakeWhile<CheckBox>(cb => cb.Checked);\n\nThat works fine if the checkboxes are neste...
I have a bit of html like so: <a href="#somthing" id="a1"><img src="something" /></a> <a href="#somthing" id="a2"><img src="something" /></a> I need to strip off the links so I'm just left with a couple of image tags. What would be the most efficient way to do this with jQuery?
You can easily strip off the links from your HTML and keep only the `<img>` tags using jQuery. Here's a straightforward way to do it: ```javascript $('a').each(function() { // Get the <img> tag inside the <a> var img = $(this).find('img'); // Replace the <a> with the <img> $(this).replaceWith(img); });...
30,599
[ { "from": "human", "value": "I have a bit of html like so:\n<a href=\"#somthing\" id=\"a1\"><img src=\"something\" /></a>\n<a href=\"#somthing\" id=\"a2\"><img src=\"something\" /></a>\n\nI need to strip off the links so I'm just left with a couple of image tags. What would be the most efficient way to do t...
Using MSSQL2005, can I truncate a table with a foreign key constraint if I first truncate the child table (the table with the primary key of the FK relationship)? I know that I can either Use a DELETE without a where clause and then RESEED the identity (or) Remove the FK, truncate the table, and recreate the FK. I th...
In SQL Server, when you have a foreign key constraint between two tables, truncating the parent table (the table that contains the primary key) while the child table (the table that contains the foreign key) still exists and has records will lead to a restriction that prevents truncating the parent table. The misunder...
28,466
[ { "from": "human", "value": "Using MSSQL2005, can I truncate a table with a foreign key constraint if I first truncate the child table (the table with the primary key of the FK relationship)?\nI know that I can either\n\nUse a DELETE without a where clause and then RESEED the identity (or)\nRemove the FK, t...
See question above.
It seems there may have been an issue since I don’t see the question you're referring to. Could you please restate it? I'll be happy to help!
33,606
[ { "from": "human", "value": "See question above.\n" }, { "from": "gpt", "value": "It seems there may have been an issue since I don’t see the question you're referring to. Could you please restate it? I'll be happy to help!" } ]
I need to check the RequestType of an HttpRequest in ASP.NET (or WebRequest.Method). I know that I can just use the string values "POST" or "GET" for the request type, but I could have sworn there was a constant somewhere in some class in .NET that contained the values. Out of curiosity I was wondering if anyone knew w...
In ASP.NET, while the common HTTP methods such as "GET" and "POST" are frequently used as string literals, there are also constants defined in the `System.Net.WebRequest` class for these HTTP methods. Here are the relevant constants you might be interested in: - `WebRequestMethods.Http.Get` for "GET" - `WebRequestMe...
29,712
[ { "from": "human", "value": "I need to check the RequestType of an HttpRequest in ASP.NET (or WebRequest.Method). I know that I can just use the string values \"POST\" or \"GET\" for the request type, but I could have sworn there was a constant somewhere in some class in .NET that contained the values.\nOut...
It is common knowledge that built-in enums in C++ are not typesafe. I was wondering which classes implementing typesafe enums are used out there... I myself use the following "bicycle", but it is somewhat verbose and limited: typesafeenum.h: struct TypesafeEnum { // Construction: public: TypesafeEnum(): id (next_id...
If you're looking for typesafe enums in C++ that adhere to your requirements, there are a few alternatives to the `TypesafeEnum` class you've shared. Below are some classes and patterns commonly used that match your requirements while offering better flexibility and safety. ### 1. `std::variant` and `std::string` with...
21,952
[ { "from": "human", "value": "It is common knowledge that built-in enums in C++ are not typesafe.\nI was wondering which classes implementing typesafe enums are used out there...\nI myself use the following \"bicycle\", but it is somewhat verbose and limited:\ntypesafeenum.h:\nstruct TypesafeEnum\n{\n// Cons...
How would I print a spinning curser in a utility that runs in a terminal using standard C? I'm looking for something that prints: \ | / - over and over in the same position on the screen? Thanks
To print a spinning cursor in a terminal using standard C, you can use a loop to display the characters in the sequence `\ | / -`, updating the position each time by moving the cursor back to the same spot. You'll need to use escape sequences to manage the cursor's position in the terminal. Here is a simple implementat...
28,032
[ { "from": "human", "value": "How would I print a spinning curser in a utility that runs in a terminal using standard C?\nI'm looking for something that prints: \\ | / - over and over in the same position on the screen?\nThanks \n" }, { "from": "gpt", "value": "To print a spinning cursor in a ter...
I use this code to create a .zip with a list of files: ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)); for (int i=0;i<srcFiles.length;i++){ String fileName=srcFiles[i].getName(); ZipEntry zipEntry = new ZipEntry(fileName); zos.putNextEntry(zipEntry); InputStream fis = new File...
The way the `ZipOutputStream` works is somewhat like this: 1. **READ DATA**: It reads data from the source file into a buffer. 2. **PROCESS DATA**: The data may undergo some compression (if the `ZipOutputStream` is configured to do so). 3. **WRITE DATA**: The compressed data (or uncompressed if you're not compressing)...
29,083
[ { "from": "human", "value": "I use this code to create a .zip with a list of files:\nZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile));\n\nfor (int i=0;i<srcFiles.length;i++){\n String fileName=srcFiles[i].getName();\n ZipEntry zipEntry = new ZipEntry(fileName);\n zos.putNext...
I have a custom cell renderer set in JTable and it works but instead an "x" visible on buttons being table cells I see "..." (three dots). What did I miss ?? /*************************************************************************** * Listener reagujący na dodanie nowej wartości **********************************...
The issue you're encountering where the button text displays as "..." instead of "x" is likely related to how the JButton is being rendered within the `JTable`. Specifically, it might be due to the size constraints of the button or how it's being painted. Here are a few adjustments you can make to ensure the button di...
28,270
[ { "from": "human", "value": "I have a custom cell renderer set in JTable and it works but instead an \"x\" visible on buttons being table cells I see \"...\" (three dots). What did I miss ??\n /***************************************************************************\n * Listener reagujący na dodanie now...
In general, is it a best practice to have simple POJO Java classes implement java.io.Serializable?
Yes, it is generally considered a best practice for simple Plain Old Java Objects (POJOs) to implement `java.io.Serializable` if you anticipate that the objects will need to be serialized. Serialization is the process of converting an object into a byte stream, which can then be saved to a file, sent over a network, or...
29,147
[ { "from": "human", "value": "In general, is it a best practice to have simple POJO Java classes implement java.io.Serializable?\n" }, { "from": "gpt", "value": "Yes, it is generally considered a best practice for simple Plain Old Java Objects (POJOs) to implement `java.io.Serializable` if you an...
I want to write an app to test whether a Windows machine is responding correctly to RDP (Remote Desktop) - i.e. to check if the machine not only allows the connection, but is also responding normally, and is not hung or otherwise responding abnormally. Is there a library or utility that I can use to do this? My searche...
Creating an application to test the responsiveness of a Windows machine via RDP (Remote Desktop Protocol) can be a bit challenging since most libraries and tools focus on full RDP clients rather than simply testing the connection status and responsiveness. However, there are several approaches you can take in Java or s...
27,687
[ { "from": "human", "value": "I want to write an app to test whether a Windows machine is responding correctly to RDP (Remote Desktop) - i.e. to check if the machine not only allows the connection, but is also responding normally, and is not hung or otherwise responding abnormally.\nIs there a library or uti...
I am putting together some ideas for our automated testing platform and have been looking at Selenium for the test runner. I am wrapping the recorded Selenium C# scripts in an MbUnit test, which is being triggered via the MbUnit NAnt task. The Selenium test client is created as follows: selenium = new DefaultSelenium("...
To achieve parameterization of your Selenium tests without embedding the host, port, and URL directly into your test code, you have a few options. Here are some approaches that might help simplify your setup: ### 1. Using NAnt Properties You can pass properties from your NAnt build file to your tests by using the `-D...
27,550
[ { "from": "human", "value": "I am putting together some ideas for our automated testing platform and have been looking at Selenium for the test runner.\nI am wrapping the recorded Selenium C# scripts in an MbUnit test, which is being triggered via the MbUnit NAnt task. The Selenium test client is created as...
I have a website that is deployed between 3 different environments - Dev, Stage, and Prod. For Stage and Prod, the site can resolve local paths to images with just the base url to the file, such as /SiteImages/banner.png. However, on the Dev server I have to hard code the full URL of the image path for the image to be ...
In IIS 6.0 on Windows Server 2003, the behavior you are experiencing with the image paths is often related to the way the application is configured and how the server is handling requests. Here are a few steps you can take to ensure that the Dev server resolves local paths in the same manner as the Stage and Prod serve...
22,546
[ { "from": "human", "value": "I have a website that is deployed between 3 different environments - Dev, Stage, and Prod. For Stage and Prod, the site can resolve local paths to images with just the base url to the file, such as /SiteImages/banner.png. However, on the Dev server I have to hard code the full U...
I have image data and i want to get a sub image of that to use as an opengl texture. glGenTextures(1, &m_name); glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldName); glBindTexture(GL_TEXTURE_2D, m_name); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, G...
To create a new texture from a sub-region of an existing image in OpenGL, you can indeed use `glTexSubImage2D`, but you need to be careful about how you're handling your data and texture bindings. Here’s how to properly load a sub-image as a texture. ### Step-by-Step Process 1. **Generate and Bind the New Texture**: ...
25,558
[ { "from": "human", "value": "I have image data and i want to get a sub image of that to use as an opengl texture. \nglGenTextures(1, &m_name);\nglGetIntegerv(GL_TEXTURE_BINDING_2D, &oldName);\nglBindTexture(GL_TEXTURE_2D, m_name);\nglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\nglTexPara...
I've been running into this problem with Flex for nearly a year, and each time I work up a quick hack solution that works for the time being. I'd like to see if anyone has a better idea. Here are the conditions of a problem: |------Container ------------| | explicitHeight: 400 (or whatever) | ...
Your situation with Flex and the layout behavior of the `VBox` is indeed a common challenge. The `VBox` is designed to expand to fit its children, and when its height is set to a percentage, it can sometimes behave unexpectedly depending on the content within it. However, there are a few strategies you can explore to b...
26,589
[ { "from": "human", "value": "I've been running into this problem with Flex for nearly a year, and each time I work up a quick hack solution that works for the time being. I'd like to see if anyone has a better idea.\nHere are the conditions of a problem:\n|------Container ------------|\n| explicitHeight:...
After I upgraded to the beta, I'm having trouble with Html.RadioButtonList. Can someone show me what I'm doing wrong? The code: <% Html.RadioButtonList( "voter" + voter.Id, new SelectList(new[]{"yes","no","abstain"}, "yes")).Each(x => Response.Write(x)); %> And the exception I get: [ArgumentNullException: Val...
The issue you are experiencing seems to stem from how the `SelectList` is being constructed for the `Html.RadioButtonList` method. Specifically, the `SelectList` constructor expects a collection of items that can contain a value and a text. When you pass a string array like `new[] { "yes", "no", "abstain" }`, it does n...
30,153
[ { "from": "human", "value": "After I upgraded to the beta, I'm having trouble with Html.RadioButtonList. Can someone show me what I'm doing wrong?\nThe code:\n<% Html.RadioButtonList(\n \"voter\" + voter.Id,\n new SelectList(new[]{\"yes\",\"no\",\"abstain\"}, \"yes\")).Each(x => Response.Write(x)); %...
I have a query on my database as such: SELECT * FROM expenses WHERE user_id = ? AND dated_on = ? I have added an index to the table on both the user_id and dated_on columns. When I inspect the indexes using SHOW INDEXES FROM expenses, there are two lines -- one with a seq_in_index value of 1, the other with a seq_in_...
When you create a composite index on multiple columns (in your case, `user_id` and `dated_on`), that index can be used effectively for queries that filter on one or both of those columns. However, the effectiveness can vary depending on the specific query. ### 1. Query: `SELECT * FROM expenses WHERE user_id = ?` When...
27,554
[ { "from": "human", "value": "I have a query on my database as such:\nSELECT * FROM expenses WHERE user_id = ? AND dated_on = ?\n\nI have added an index to the table on both the user_id and dated_on columns. When I inspect the indexes using SHOW INDEXES FROM expenses, there are two lines -- one with a seq_i...
What would be the best way to check that a std::vector is sorted? Is there something faster than a loop checking that v[i]<=v[i+1]? Is it faster/cleaner with iterators? Or is it actually better to just call sort every time (though the "v is already sorted" case is quite common)? We can safely assume the vector only con...
To check if a `std::vector` is sorted, the most straightforward way is indeed to loop through the elements and verify that each element is less than or equal to the next element. The complexity of this operation is O(n), where n is the number of elements in the vector. Unfortunately, there's no way to check if the vect...
28,614
[ { "from": "human", "value": "What would be the best way to check that a std::vector is sorted? Is there something faster than a loop checking that v[i]<=v[i+1]? Is it faster/cleaner with iterators? Or is it actually better to just call sort every time (though the \"v is already sorted\" case is quite common...
I'm having an issue getting validation error messages to display for a particular field in a Django form, where the field in question is a ModelMultipleChoiceField. In the clean(self) method for the Form, I try to add the error message to the field like so: msg = 'error' self._errors['field_name'] = ErrorList([msg]) ra...
In Django forms, validation errors for fields are typically managed in the `clean()` method of the form. When dealing with a `ModelMultipleChoiceField`, it's important to understand that setting errors in the `_errors` dictionary directly can be tricky, especially since Django forms often validate fields independently....
28,731
[ { "from": "human", "value": "I'm having an issue getting validation error messages to display for a particular field in a Django form, where the field in question is a ModelMultipleChoiceField.\nIn the clean(self) method for the Form, I try to add the error message to the field like so:\nmsg = 'error'\nself...
I'm looking for a dbm-like library that I can use in place of Berkeley DB, which I'm currently using. My main reason for switching is the licensing fees for BDB are pretty high (free for open source apps, but my employer does not want to open source this particular app for various reasons). I've looked briefly at qdbm ...
If you're looking for an alternative to Berkeley DB with a similar key-value store functionality, but without the licensing restrictions, there are several options to consider that can handle large datasets and high key counts: 1. **LevelDB**: Developed by Google, LevelDB is an efficient key-value storage library that...
27,792
[ { "from": "human", "value": "I'm looking for a dbm-like library that I can use in place of Berkeley DB, which I'm currently using. My main reason for switching is the licensing fees for BDB are pretty high (free for open source apps, but my employer does not want to open source this particular app for vario...
I have an ASHX handler that returns an XML response (FileStructureXML.ashx). Now I need to get the XML response from the ASHX handler and use it as a data source for my ASPX page. If I point the XMLDataSource to a static XML file on the server, the treeview populates as expected. However, if I point the XMLDataSource ...
To use an ASHX handler as a data source for an `XmlDataSource` in an ASP.NET Web Forms application, you need to ensure that the ASHX handler correctly generates and returns the XML content in the proper format. Here are the steps you should follow to achieve this: ### Step 1: Ensure ASHX Handler Returns Proper XML Ma...
26,891
[ { "from": "human", "value": "I have an ASHX handler that returns an XML response (FileStructureXML.ashx).\nNow I need to get the XML response from the ASHX handler and use it as a data source for my ASPX page.\nIf I point the XMLDataSource to a static XML file on the server, the treeview populates as expect...
We are currently researching ways of enhancing image quality prior to submission to OCR. The OCR engine we are currently utilizing is the Scansoft API from Nuance (v15). We were researching the Lead Tools but have since decided to look elsewhere. The licensing costs associated with Lead Tools is just too great. To ...
Enhancing image quality prior to Optical Character Recognition (OCR) can significantly improve the accuracy of text recognition. Since you are looking for Java solutions with image enhancement capabilities such as deskewing, despeckling, line removal, punch hole removal, sharpening, etc., here are several libraries and...
21,358
[ { "from": "human", "value": "We are currently researching ways of enhancing image quality prior to submission to OCR. The OCR engine we are currently utilizing is the Scansoft API from Nuance (v15). We were researching the Lead Tools but have since decided to look elsewhere. The licensing costs associate...
I am writing a software synthesizer and need to generate bandlimited, alias free waveforms in real time at 44.1 kHz samplerate. Sawtooth waveform would do for now, since I can generate a pulse wave by mixing two sawtooths together, one inverted and phase shifted. So far I've tried the following approaches: Precomputin...
Generating bandlimited, alias-free waveforms in real-time can be challenging, especially when you want to maintain both high sound quality and low CPU usage. Here are some commonly used techniques that you can consider for generating a bandlimited sawtooth wave in your software synthesizer: ### 1. **Phase Distortion T...
22,774
[ { "from": "human", "value": "I am writing a software synthesizer and need to generate bandlimited, alias free waveforms in real time at 44.1 kHz samplerate. Sawtooth waveform would do for now, since I can generate a pulse wave by mixing two sawtooths together, one inverted and phase shifted.\nSo far I've tr...
I have a database that stores events in it and a page with a calendar object on it. When rendering the days it looks through the months events and if any match the current day being rendered it creates a linkbutton to represent the event in the day on the calendar and adds it to that cell. I add some javascript to the ...
To set a session variable when the user clicks a dynamically created link button that redirects to a new page for event details, you can take several approaches. Since you mentioned you were having issues with `PostBackUrl`, let's focus on using JavaScript to achieve this along with the session variable. Here’s a gene...
24,614
[ { "from": "human", "value": "I have a database that stores events in it and a page with a calendar object on it. When rendering the days it looks through the months events and if any match the current day being rendered it creates a linkbutton to represent the event in the day on the calendar and adds it to...
Is there a method, or some other light-weight way, to check if a reference is to a disposed object? P.S. - This is just a curiousity (sleep well, not in production code). Yes, I know I can catch the ObjectDisposedException upon trying to access a member of the object.
In .NET, there is no built-in, direct method to check if an object has been disposed without accessing its members, which is why catching an `ObjectDisposedException` is a common practice. However, if you’re curious about lighter ways to track disposed objects, here are a few options you can consider: 1. **Implement a...
23,765
[ { "from": "human", "value": "Is there a method, or some other light-weight way, to check if a reference is to a disposed object?\nP.S. - This is just a curiousity (sleep well, not in production code). Yes, I know I can catch the ObjectDisposedException upon trying to access a member of the object.\n" }, ...
Given a System.Timers.Timer, is there a way from the main thread to tell if the worker thread running the elapsed event code is still running? In other words, how can one make sure the code running in the worker thread is not currently running before stopping the timer or the main app/service thread the timer is runnin...
The `System.Timers.Timer` class works by creating a worker thread that executes the elapsed event handler when the timer interval elapses. However, there's no built-in way to query the timer to see if the elapsed event is currently executing. This can lead to potential issues if you stop the timer while the elapsed eve...
28,146
[ { "from": "human", "value": "Given a System.Timers.Timer, is there a way from the main thread to tell if the worker thread running the elapsed event code is still running?\nIn other words, how can one make sure the code running in the worker thread is not currently running before stopping the timer or the m...
Please one library per answer so that people can vote for the individually.
Sure! Here’s a library you can consider: **NumPy** NumPy is a powerful library for numerical computing in Python. It provides support for arrays, matrices, and a collection of mathematical functions to operate on these data structures efficiently. It's widely used in data science, machine learning, and scientific co...
33,072
[ { "from": "human", "value": "Please one library per answer so that people can vote for the individually.\n" }, { "from": "gpt", "value": "Sure! Here’s a library you can consider:\n\n**NumPy** \n\nNumPy is a powerful library for numerical computing in Python. It provides support for arrays, matri...
I am trying to rewrite URLs using mod_rewrite. It is enabled in httpd.conf and url rewriting works if the lines are in the httpd.conf file. However, I would like the rules to be in the .htaccess file. It doesn't appear that .htaccess is being processed at all by Apache on Win2k. I have ReWriteLogging turned all the w...
To ensure that your `.htaccess` file is processed correctly by Apache, there are a few things you need to check and modify in your configuration. Here's a list of troubleshooting steps and adjustments: 1. **Ensure AllowOverride is set correctly**: In your `httpd.conf`, you need to make sure that the `AllowOverride`...
27,438
[ { "from": "human", "value": "I am trying to rewrite URLs using mod_rewrite. It is enabled in httpd.conf and url rewriting works if the lines are in the httpd.conf file. However, I would like the rules to be in the .htaccess file.\nIt doesn't appear that .htaccess is being processed at all by Apache on Win...
I'm trying to get a query working that takes the values (sometimes just the first part of a string) from a form control. The problem I have is that it only returns records when the full string is typed in. i.e. in the surname box, I should be able to type gr, and it brings up green grey graham but at present it's not ...
To modify your SQL query so that it allows for partial matching when searching by first name, surname, or date of birth, you need to ensure that the criteria use the `Like` operator appropriately. Your current query structure is almost correct, but the use of `IIf` may complicate things unnecessarily. Instead of usin...
23,166
[ { "from": "human", "value": "I'm trying to get a query working that takes the values (sometimes just the first part of a string) from a form control. The problem I have is that it only returns records when the full string is typed in.\ni.e. in the surname box, I should be able to type gr, and it brings up \...
I'm working on an import (from Excel) dialog to select ranges of cells. When the range is selected, I use the event sink to catch the event and highlight the first row and first column. I need to unhighlight the previous selection's first row and column. I don't think it's safe to just get the selected range at the ti...
In your situation, you're correct that simply holding onto the `Range` object retrieved from `_Application::Selection` can lead to issues because it may not be valid when the selection changes. Instead, you should consider storing the cell addresses of the previously selected range as strings, which allows you to recre...
25,982
[ { "from": "human", "value": "I'm working on an import (from Excel) dialog to select ranges of cells.\nWhen the range is selected, I use the event sink to catch the event and highlight the first row and first column.\nI need to unhighlight the previous selection's first row and column. I don't think it's sa...
Using the AddHandler method, if I never use RemoveHandler, will that lead to memory leaks in some conditions and situations? I'm not so sure about the truth of this. And are there other causes to memory leaks that are solely available in VB as opposed to C#?
Using the `AddHandler` method in Visual Basic (VB.NET) allows you to subscribe to events. If you never use `RemoveHandler` to unsubscribe from these events, it can lead to memory leaks in certain conditions. Here's why: 1. **Event Handlers and Garbage Collection**: When you subscribe to an event using `AddHandler`, th...
17,309
[ { "from": "human", "value": "Using the AddHandler method, if I never use RemoveHandler, will that lead to memory leaks in some conditions and situations? I'm not so sure about the truth of this.\nAnd are there other causes to memory leaks that are solely available in VB as opposed to C#?\n" }, { "fr...
How do you connect to a remote server via IP address in the manner that TOAD, SqlDeveloper, are able to connect to databases with just the ip address, username, SID and password? Whenever I try to specify and IP address, it seems to be taking it locally. In other words, how should the string for cx_Oracle.connect() be ...
To connect to a remote Oracle database using the `cx_Oracle` library in Python, you need to specify the connection string in a format that includes the database host (IP address or hostname), the port, and the service name or SID (System Identifier). This is typically done using the following format: ``` username/pass...
26,984
[ { "from": "human", "value": "How do you connect to a remote server via IP address in the manner that TOAD, SqlDeveloper, are able to connect to databases with just the ip address, username, SID and password?\nWhenever I try to specify and IP address, it seems to be taking it locally.\nIn other words, how sh...
I've built a full-text catalog on a SQL 2005 box that, after it's re-build process completes, runs extremely slow. I've implemented a hack (i.e. try...catch{do again}) so that my users don't get a timeout error; this makes me feel bad inside. All subsequent queries are lightning fast. Has anyone experienced this issu...
It sounds like you are experiencing performance issues immediately after rebuilding your full-text catalog in SQL Server 2005. This is a known scenario where SQL Server's full-text indexing can take some time to stabilize after a rebuild, leading to slow performance for queries that utilize the full-text index. Here a...
19,760
[ { "from": "human", "value": "I've built a full-text catalog on a SQL 2005 box that, after it's re-build process completes, runs extremely slow. I've implemented a hack (i.e. try...catch{do again}) so that my users don't get a timeout error; this makes me feel bad inside. All subsequent queries are lightni...
A general architecture question in Sitecore 6... Let’s say we have a situation where we have 10,000 items implementing a “Press Release” template. These items are stored in Sitecore at /sitecore/content/home/press/*. On our homepage, we’d like to display some information concerning the 3 most recent press releases. We’...
In Sitecore 6, querying a large number of items like your 10,000 press releases can indeed pose performance challenges if not handled properly. Your current approach, where you load all items and then sort them in memory, can lead to significant performance issues, especially with a large dataset. Fortunately, there ar...
27,661
[ { "from": "human", "value": "A general architecture question in Sitecore 6...\nLet’s say we have a situation where we have 10,000 items implementing a “Press Release” template. These items are stored in Sitecore at /sitecore/content/home/press/*. On our homepage, we’d like to display some information concer...
I'd like to read an arbitrary PDF on my iPod Touch (or iPhone) with a reasonable font size. Some PDFs are already formatted with narrow columns and wide margins. Once I zoom the document to "remove" the margins, the text is easy to read. Most documents have one very wide column of text. When I zoom in enough to make ...
If you're looking to convert wide-column PDFs into narrow-column PDFs for easier reading on your iPod Touch or iPhone, there are several approaches you could take. You can use libraries or tools that provide the capability to read and manipulate PDF documents. Below are some options and resources you could explore: ##...
26,779
[ { "from": "human", "value": "I'd like to read an arbitrary PDF on my iPod Touch (or iPhone) with a reasonable font size. Some PDFs are already formatted with narrow columns and wide margins. Once I zoom the document to \"remove\" the margins, the text is easy to read.\nMost documents have one very wide co...
My current app needs to store address information for a user. I'm currently debating whether to use the customary street address / city / state / zip textboxes and dropdowns or to go with Google's method of simply having everything on one line. Any thoughts on the pros/cons of storing address information in either of...
When deciding how to store address information in your app, both the traditional approach (using separate fields for street address, city, state, and zip) and the single-line approach (like Google) have their pros and cons. Here are some points to consider for each method: ### Traditional Approach (Separate Fields) *...
26,297
[ { "from": "human", "value": "My current app needs to store address information for a user. I'm currently debating whether to use the customary street address / city / state / zip textboxes and dropdowns or to go with Google's method of simply having everything on one line. Any thoughts on the pros/cons of...
The MSI stores the installation directory for the future uninstall tasks. Using the INSTALLPROPERTY_INSTALLLOCATION property (that is "InstallLocation") works only the installer has set the ARPINSTALLLOCATION property during the installation. But this property is optional and almost nobody uses it. How could I retrieve...
To retrieve the installation directory of an MSI package when the `ARPINSTALLLOCATION` property is not set, you can take the following approaches: ### 1. Use Windows Installer APIs You can use the Windows Installer APIs such as `MsiGetProductInfo`, which allows you to retrieve information about the installed product, ...
27,272
[ { "from": "human", "value": "The MSI stores the installation directory for the future uninstall tasks.\nUsing the INSTALLPROPERTY_INSTALLLOCATION property (that is \"InstallLocation\") works only the installer has set the ARPINSTALLLOCATION property during the installation. But this property is optional and...
Is it possible to create an STL-like container, or even just an STL-style iterator, for an existing array of POD-type elements? For example, suppose I have an array of ints. It would be convenient to be able to call some of the STL functions, such as find_if, count_if, or sort directly on this array. Non-solution: cop...
Yes, it is absolutely possible to create an STL-like container or an STL-style iterator for an existing array of POD (Plain Old Data) type elements in C++. You can create a wrapper class that holds a pointer to the array and its size, and then implement the necessary iterator functions to allow STL algorithms to work d...
25,260
[ { "from": "human", "value": "Is it possible to create an STL-like container, or even just an STL-style iterator, for an existing array of POD-type elements?\nFor example, suppose I have an array of ints. It would be convenient to be able to call some of the STL functions, such as find_if, count_if, or sort...
What is the upper limit for an autoincrement primary key in SQL Server? What happens when an SQL Server autoincrement primary key reaches its upper limit?
In SQL Server, the upper limit for an `IDENTITY` column, which is commonly used for autoincrementing primary keys, depends on the data type you choose for the column. Here are the common data types used for `IDENTITY` columns and their respective maximum values: - **`TINYINT`**: Range from 0 to 255 - **`SMALLINT`**: R...
27,706
[ { "from": "human", "value": "What is the upper limit for an autoincrement primary key in SQL Server? \nWhat happens when an SQL Server autoincrement primary key reaches its upper limit?\n" }, { "from": "gpt", "value": "In SQL Server, the upper limit for an `IDENTITY` column, which is commonly us...
On large files (~200+ MB), I get the 503 error when I read the stream. ftp = (FtpWebRequest)WebRequest.Create(new Uri(address.AbsoluteUri + @"/" + file.Name)); ftp.Credentials = new NetworkCredential(username, password); ftp.Method = WebRequestMethods.Ftp.DownloadFile; response = (FtpWebResponse)ftp.GetResponse(); An...
When dealing with large files over FTP, encountering a 503 error can be due to several reasons, including server limitations, timeout issues, or resource constraints. Here are some suggestions and best practices for downloading large files via FTP that could help resolve the issue: 1. **Check Server Limits**: Ensure t...
26,404
[ { "from": "human", "value": "On large files (~200+ MB), I get the 503 error when I read the stream.\nftp = (FtpWebRequest)WebRequest.Create(new Uri(address.AbsoluteUri + @\"/\" + file.Name));\nftp.Credentials = new NetworkCredential(username, password);\nftp.Method = WebRequestMethods.Ftp.DownloadFile;\n\nr...
I'm trying to create a logger for a GWT application as an exercise to evaluate GWT. What I specifically want to do is have it so that I can post messages to a client side label at any point from the server side. So, if some interesting stuff has happened on the server the client can be updated. My First question is, is...
Creating a logger for a GWT (Google Web Toolkit) application that allows server-side events to notify the client-side UI is definitely possible. However, you have to use some specific techniques since GWT is primarily designed as a client-side framework. Here are the answers to your questions: ### 1. Is this possible?...
24,477
[ { "from": "human", "value": "I'm trying to create a logger for a GWT application as an exercise to evaluate GWT. What I specifically want to do is have it so that I can post messages to a client side label at any point from the server side. So, if some interesting stuff has happened on the server the client...
I hope there's a SharePoint expert here on SO who can help with this. Here's the problem. My SharePoint logs contain this line, several times: An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon...
Certainly! The error message you're encountering indicates that there are instances where `SPRequest` objects, or their parent objects like `SPSite` or `SPWeb`, are not being properly disposed. This can lead to memory leaks and performance issues in your SharePoint application. Here's a systematic approach you can fol...
25,395
[ { "from": "human", "value": "I hope there's a SharePoint expert here on SO who can help with this.\nHere's the problem. My SharePoint logs contain this line, several times:\nAn SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its ...
How can I retrieve the current working directory of cmd.exe? This seems possible. For example using ProcessExplorer, select CMD.exe, right click, properties, Image tab, "Current Directory" relects the directory set using the CD or CHDIR commands. I've looked at the .NET Process and ProcessStartInfo classes (ProcessS...
To retrieve the current working directory of a `cmd.exe` process (or any process, for that matter) in Windows, you can utilize the Windows API through PInvoke or the WMI (Windows Management Instrumentation) method. ### Method 1: Using PInvoke with `OpenProcess`, `GetProcessId`, and `QueryFullProcessImageName` Here’s...
24,037
[ { "from": "human", "value": "How can I retrieve the current working directory of cmd.exe? \nThis seems possible. For example using ProcessExplorer, select CMD.exe, right click, properties, Image tab, \"Current Directory\" relects the directory set using the CD or CHDIR commands.\nI've looked at the .NET P...
I'm trying to draw images on the iPhone using with rounded corners, a la the contact images in the Contacts app. I've got code that generally work, but it occasionally crashes inside of the UIImage drawing routines with an EXEC_BAD_ACCESS - KERN_INVALID_ADDRESS. I thought this might be related to the cropping question ...
It appears that you're experiencing an `EXC_BAD_ACCESS` crash, which indicates that your code is trying to access a memory location that it shouldn't. This can happen for a variety of reasons, including dereferencing a null or invalid pointer. Looking at the code you've provided, I see a couple of potential issues tha...
24,835
[ { "from": "human", "value": "I'm trying to draw images on the iPhone using with rounded corners, a la the contact images in the Contacts app. I've got code that generally work, but it occasionally crashes inside of the UIImage drawing routines with an EXEC_BAD_ACCESS - KERN_INVALID_ADDRESS. I thought this m...
This is somewhat of a follow-up question to this question. Suppose I have an inheritance tree as follows: Car -> Ford -> Mustang -> MustangGT Is there a benefit to defining interfaces for each of these classes? Example: ICar -> IFord -> IMustang -> IMustangGT I can see that maybe other classes (like Chevy) would wan...
Defining interfaces in an inheritance tree can have both benefits and downsides, and whether or not to implement interfaces depends on several factors, such as your design goals, flexibility requirements, and overall architecture. ### Benefits of Defining Interfaces 1. **Decoupling**: Interfaces can help decouple you...
28,291
[ { "from": "human", "value": "This is somewhat of a follow-up question to this question.\nSuppose I have an inheritance tree as follows:\nCar -> Ford -> Mustang -> MustangGT\n\nIs there a benefit to defining interfaces for each of these classes? Example:\nICar -> IFord -> IMustang -> IMustangGT\n\nI can see...
I have multiple layers in an application and i find myself having to bubble up events to the GUI layer for doing status bar changes, etc . . I find myself having to write repeated coded where each layer simply subscribes to events from the lower layer and then in the call back simply raise an event up the chain. Is th...
Yes, there are several design patterns and strategies you can use to make your event handling more efficient and reduce repetitive code when bubbling events up through multiple layers. Here are a few suggestions: 1. **Event Aggregator (or Mediator Pattern)**: - Implement an Event Aggregator that acts as a centraliz...
22,192
[ { "from": "human", "value": "I have multiple layers in an application and i find myself having to bubble up events to the GUI layer for doing status bar changes, etc . . I find myself having to write repeated coded where each layer simply subscribes to events from the lower layer and then in the call back s...
I have a series of ASCII flat files coming in from a mainframe to be processed by a C# application. A new feed has been introduced with a Packed Decimal (COMP-3) field, which needs to be converted to a numerical value. The files are being transferred via FTP, using ASCII transfer mode. I am concerned that the binary fi...
Dealing with Packed Decimal (COMP-3) fields can be tricky, especially when handling data transfers between systems like a mainframe and a C# application. Here's a breakdown of how you can handle the conversion of Packed Decimal values effectively, along with some insights into potential issues with FTP transfers. ### ...
24,383
[ { "from": "human", "value": "I have a series of ASCII flat files coming in from a mainframe to be processed by a C# application. A new feed has been introduced with a Packed Decimal (COMP-3) field, which needs to be converted to a numerical value.\nThe files are being transferred via FTP, using ASCII transf...
My company has a subsidiary with a slow Internet connection. Our developers there suffer to interact with our central Subversion server. Is it possible to configure a slave/mirror for them? They would interact locally with the server and all the commits would be automatically synchronized to the master server. This s...
Yes, it is possible to set up a mirror or slave Subversion server that allows your developers to work locally while keeping the main server synchronized. Below are the steps you can take to achieve this setup: ### Overview of the Setup 1. **Local Mirror Server**: Set up a local Subversion server (let's call it `LocalS...
26,625
[ { "from": "human", "value": "My company has a subsidiary with a slow Internet connection. Our developers there suffer to interact with our central Subversion server. Is it possible to configure a slave/mirror for them? They would interact locally with the server and all the commits would be automatically s...
I'm working on a site that involves displaying a ton of product images from a variety of online retailers. Since most of the page weight is in the images, I thought it'd be worth looking into techniques for trimming down the file size a bit more. The images are already JPEGs. I know PNGs have a lot of extra cruft that...
When working with JPEG images, there are indeed several techniques and considerations to optimize file sizes while maintaining quality. Let's address your questions one by one: ### 1. Further Compressing JPEGs **Is it worth further compressing the JPEGs?** Yes, further compressing JPEGs can be beneficial, but it mu...
25,806
[ { "from": "human", "value": "I'm working on a site that involves displaying a ton of product images from a variety of online retailers. Since most of the page weight is in the images, I thought it'd be worth looking into techniques for trimming down the file size a bit more. \nThe images are already JPEGs. ...
I have an Electronic Workforce (EWF) application that records the caller speaking. The system needs to record for 120 seconds then play a message and hangup. I set a maximum length of 120 seconds and a minimum length of 1 second. I didn't want any input to disrupt the recording, so I checked "Discard Earlier User In...
Based on your description, there are a few potential reasons why some recordings are ending up at exactly five seconds, leading to the "Voice Msg Too Short" error. Here are some possibilities and suggestions to investigate and mitigate the issue: 1. **User Behavior**: Even with the current settings to discard early in...
24,941
[ { "from": "human", "value": "I have an Electronic Workforce (EWF) application that records the caller speaking. The system needs to record for 120 seconds then play a message and hangup. I set a maximum length of 120 seconds and a minimum length of 1 second. I didn't want any input to disrupt the recordi...
I have a form a user can enter their name, then it will add it to $message to be sent in an email. Is it better to use $_POST or $_REQUEST? Here is a snippet of using $_REQUEST $message.= "Name: ".$_REQUEST["fname"]." ".$_REQUEST["mname"]." ".$_REQUEST["lname"]."\n";
When deciding between using `$_POST` and `$_REQUEST` in PHP, there are several important considerations to keep in mind. ### Differences Between `$_POST` and `$_REQUEST` - **`$_POST`**: This superglobal array contains data sent to the server via HTTP POST method. It is a more secure and specific way to retrieve data, ...
27,246
[ { "from": "human", "value": "I have a form a user can enter their name, then it will add it to $message to be sent in an email.\nIs it better to use $_POST or $_REQUEST?\nHere is a snippet of using $_REQUEST\n$message.= \"Name: \".$_REQUEST[\"fname\"].\" \".$_REQUEST[\"mname\"].\" \".$_REQUEST[\"lname\"].\"...
Some APIs, like the WebClient, use the Event-based Async pattern. While this looks simple, and probably works well in a loosely coupled app (say, BackgroundWorker in a UI), it doesn't chain together very well. For instance, here's a program that's multithreaded so the async work doesn't block. (Imagine this is going i...
The Event-based Asynchronous Pattern (EAP) can indeed lead to complex and hard-to-maintain code, especially when trying to chain multiple asynchronous operations together. While the EAP is a valid approach, it can lead to deeply nested callbacks that make it difficult to read and understand the flow of the program. On...
28,220
[ { "from": "human", "value": "Some APIs, like the WebClient, use the Event-based Async pattern. While this looks simple, and probably works well in a loosely coupled app (say, BackgroundWorker in a UI), it doesn't chain together very well. \nFor instance, here's a program that's multithreaded so the async wo...
Reading this blog post about HttpOnly cookies made me start thinking, is it possible for an HttpOnly cookie to be obtained through any form of XSS? Jeff mentions that it "raises the bar considerably" but makes it sound like it doesn't completely protect against XSS. Aside from the fact that not all browser support this...
HttpOnly cookies are indeed a significant security enhancement, as they prevent client-side scripts from accessing the cookie data. However, while they make it more difficult for attackers to steal cookies via cross-site scripting (XSS), they do not offer complete protection against all forms of XSS or other attack vec...
25,898
[ { "from": "human", "value": "Reading this blog post about HttpOnly cookies made me start thinking, is it possible for an HttpOnly cookie to be obtained through any form of XSS? Jeff mentions that it \"raises the bar considerably\" but makes it sound like it doesn't completely protect against XSS.\nAside fro...
I've got some experience with Bash, which I don't mind, but now that I'm doing a lot of Windows development I'm needing to do basic stuff/write basic scripts using the Windows command-line language. For some reason said language really irritates me, so I was considering learning Python and using that instead. Is Pytho...
Yes, Python is an excellent choice for scripting tasks on Windows, and it can be a more comfortable and powerful alternative to the built-in command-line scripting languages. Here are some reasons why Python might be suitable for your needs: 1. **Ease of Use**: Python has a clean and easy-to-read syntax, making it acc...
26,982
[ { "from": "human", "value": "I've got some experience with Bash, which I don't mind, but now that I'm doing a lot of Windows development I'm needing to do basic stuff/write basic scripts using \nthe Windows command-line language. For some reason said language really irritates me, so I was considering learni...
I was trying to programmatically go through presidential campaign contributions to see which web 2.0 people contributed to which candidates. You can get the data file indiv08.zip on the site http://www.fec.gov/finance/disclosure/ftpdet.shtml#a2007_2008 I can parse out who contributed and how much they contributed, but ...
You're correct that the Federal Election Commission (FEC) data can be a bit complex to navigate, especially when it comes to understanding the relationships between contributions, candidates, and committees. In the U.S. campaign finance system, contributions are often made to political committees rather than directly ...
16,461
[ { "from": "human", "value": "I was trying to programmatically go through presidential campaign contributions to see which web 2.0 people contributed to which candidates. You can get the data file indiv08.zip on the site http://www.fec.gov/finance/disclosure/ftpdet.shtml#a2007_2008\nI can parse out who contr...
I am told that SQL Server 2005 installation with BI tools and SQL Server 2008 with BI tools can't work together on the same computer. Apparently "some" things stop working. This was told to me by one of my team members. Since I'm new to SQL BI, I cant discount what he has said altogether and I dont want to install them...
When it comes to installing multiple versions of SQL Server on the same machine, there are a few considerations to keep in mind. SQL Server 2005 and SQL Server 2008 can technically be installed side by side without inherent issues, as they are designed to coexist on the same system. However, there are some caveats: 1....
29,092
[ { "from": "human", "value": "I am told that SQL Server 2005 installation with BI tools and SQL Server 2008 with BI tools can't work together on the same computer. Apparently \"some\" things stop working. This was told to me by one of my team members. Since I'm new to SQL BI, I cant discount what he has said...
If I create a Stored Procedure in SQL and call it (EXEC spStoredProcedure) within the BEGIN/END TRANSACTION, does this stored procedure also fall into the transaction? I didn't know if it worked like try/catches in C#.
Yes, if you create a stored procedure in SQL and call it within a `BEGIN/END TRANSACTION` block, the operations within that stored procedure will also be part of the transaction. This means that any changes made to the database inside the stored procedure will be committed or rolled back along with the outer transactio...
22,980
[ { "from": "human", "value": "If I create a Stored Procedure in SQL and call it (EXEC spStoredProcedure) within the BEGIN/END TRANSACTION, does this stored procedure also fall into the transaction?\nI didn't know if it worked like try/catches in C#.\n" }, { "from": "gpt", "value": "Yes, if you cr...
Cruisecontrol and Hudson are two popular continuous integration systems. Although both systems are able to do the automated continuous builds nicely, it just seems a lot easier to create a batch or bash build script, then use Windows scheduler or cron to schedule builds. Are there better continuous integration systems...
When it comes to continuous integration (CI) systems for C++ projects, there are indeed various options available that might offer advantages over manually scripting the builds with cron or Windows Scheduler. Here are a few considerations and alternatives you might find more beneficial, depending on your needs: ### CI...
27,296
[ { "from": "human", "value": "Cruisecontrol and Hudson are two popular continuous integration systems. Although both systems are able to do the automated continuous builds nicely, it just seems a lot easier to create a batch or bash build script, then use Windows scheduler or cron to schedule builds.\nAre t...
I'm trying to create a table under SQL Server 2008 containing a GEOMETRY column and a calculated variation thereof. Considering the following table where the calculated column returns a buffered geometry: CREATE TABLE [dbo].[Test] ( [Geometry] GEOMETRY NOT NULL, [Buffer] FLOAT NOT NULL, ...
In SQL Server 2008, you cannot create a persisted computed column of type `GEOMETRY` due to the limitations you've encountered. Since you're trying to have a `BufferedGeometry` that is persisted, you will need to consider an alternative approach. Here are a couple of workarounds: ### 1. Use a Trigger You can use an ...
24,993
[ { "from": "human", "value": "I'm trying to create a table under SQL Server 2008 containing a GEOMETRY column and a calculated variation thereof.\nConsidering the following table where the calculated column returns a buffered geometry:\nCREATE TABLE [dbo].[Test] (\n [Geometry] GEOMETRY NOT NULL,\n...
I have a server dropdownlist in an Ajax updatepanel. When I use the mouse to click on an item it fires the postback but when I click the up/down arrow to change entries, this is not firing. What could be reason?
In an ASP.NET Web Forms application that uses an Ajax `UpdatePanel`, the behavior you're experiencing with the dropdown list (also known as a `DropDownList` control) could be due to the way the dropdown list handles postbacks for different user interactions. Here's a breakdown of possible reasons and solutions: ### 1...
26,431
[ { "from": "human", "value": "I have a server dropdownlist in an Ajax updatepanel. When I use the mouse to click on an item it fires the postback but when I click the up/down arrow to change entries, this is not firing. What could be reason?\n" }, { "from": "gpt", "value": "In an ASP.NET Web For...
I'd trying to style my ComboBoxes to match the rest of the UI but I'm having problems with the IsMouseOver highlighting. It highlights with the color I specify for a second and then fades back to the default color, kind of a cool effect but not what I'm going for. Here is my style: <Style TargetType="ComboBox"> <St...
The behavior you're experiencing is likely due to the default `ControlTemplate` for the `ComboBox`, which may include animations or visual states that override your style settings. To have your specified background color persist while the mouse is over the `ComboBox`, you'll need to define a custom `ControlTemplate` fo...
25,769
[ { "from": "human", "value": "I'd trying to style my ComboBoxes to match the rest of the UI but I'm having problems with the IsMouseOver highlighting. It highlights with the color I specify for a second and then fades back to the default color, kind of a cool effect but not what I'm going for. Here is my sty...
void f(cli::array<PointF> ^points){ PointF& a = points[0]; // and so on... } Compile error at line 2. .\ndPanel.cpp(52) : error C2440: 'initializing' : cannot convert from 'System::Drawing::PointF' to 'System::Drawing::PointF &' An object from the gc heap (element of a managed array) cannot be convert...
In C++/CLI, you cannot take a reference to a managed object in the same way you would with native C++. Managed types (like `PointF` in this case) are garbage-collected and reside on the heap, and thus you cannot use references to managed types directly. Instead, you can use a `^` handle (which is the C++/CLI equivalen...
28,239
[ { "from": "human", "value": "void f(cli::array<PointF> ^points){\n PointF& a = points[0];\n // and so on...\n}\n\nCompile error at line 2. \n.\\ndPanel.cpp(52) : error C2440: 'initializing' : cannot convert from 'System::Drawing::PointF' to 'System::Drawing::PointF &'\n An object from the gc he...
Because Canvas3D doesn't have the ability to resize dynamically with the parent frame, I would like to be able to track when a user resizes a window and then resize it manually myself. (If this ends up crashing Canvas3D, as some docs suggest, I will simply destroy and recreate it when the user resizes their window). Pa...
It seems like you're encountering a common issue when dealing with the size of Swing components, especially if the component has not yet been displayed (is not visible on the screen). In Swing, many layout and sizing methods depend on the component being displayed, and if it's not, the size properties may not be set co...
29,739
[ { "from": "human", "value": "Because Canvas3D doesn't have the ability to resize dynamically with the parent frame, I would like to be able to track when a user resizes a window and then resize it manually myself. (If this ends up crashing Canvas3D, as some docs suggest, I will simply destroy and recreate i...
Alright, I am going to state up front that this question may be too involved (amount of detail not complexity) for this medium. But I figured this was the best place to start. I am attempting to setup a proof of concept project and my BIND configuration is my first big hurdle. I want to setup 3 DNS servers on 3 physi...
Setting up a private DNS infrastructure using BIND can be a bit tricky, especially when dealing with custom root zones and TLDs. Based on the configuration snippets and the output you’ve provided, it seems there are a few potential issues and areas for improvement in your BIND setup. I'll walk through some key points t...
23,340
[ { "from": "human", "value": "Alright, I am going to state up front that this question may be too involved (amount of detail not complexity) for this medium. But I figured this was the best place to start.\nI am attempting to setup a proof of concept project and my BIND configuration is my first big hurdle....
I'm processing a file, line-by-line, and I'd like to do an inverse match. For instance, I want to match lines where there is a string of six letters, but only if these six letters are not 'Andrea'. How should I do that? I'm using RegexBuddy, but still having trouble.
To achieve an inverse match in Regex, you can use a negative lookahead assertion. This will allow you to match lines that contain six letters while excluding lines that contain the specific string "Andrea". Here’s how you can structure your regex pattern: ```regex \b(?!Andrea\b)[a-zA-Z]{6}\b ``` ### Explanation: - ...
30,200
[ { "from": "human", "value": "I'm processing a file, line-by-line, and I'd like to do an inverse match. For instance, I want to match lines where there is a string of six letters, but only if these six letters are not 'Andrea'. How should I do that?\nI'm using RegexBuddy, but still having trouble.\n" }, ...
I am all about using ASP.NET MVC, but one of the areas that I hope gets improved on is Client-Side Validation. I know the most recent version (Preview 5) has a lot of new features for Validation, but they all seem to be after the page has been posted. I have seen an interesting article by Steve Sanderson... using Live ...
It's great to hear that you're actively exploring client-side validation in ASP.NET MVC! Client-side validation can significantly enhance user experience by providing immediate feedback, reducing the number of round trips to the server, and improving application performance. ### Current State of Client-Side Validation...
27,228
[ { "from": "human", "value": "I am all about using ASP.NET MVC, but one of the areas that I hope gets improved on is Client-Side Validation.\nI know the most recent version (Preview 5) has a lot of new features for Validation, but they all seem to be after the page has been posted.\nI have seen an interestin...
I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed here. In trying to figure this out I wrote the following simple test program. I simply want it to open a form on a separate thread named "UI thread" and keep the thread running as long as the form is open while...
To create a WinForms application where a form is displayed on a separate UI thread and remains responsive to user interactions, you'll need to keep the thread alive while the form is open. The issue in your current implementation is that after starting the UI thread, the `Main` thread continues executing and ultimately...
26,636
[ { "from": "human", "value": "I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed here.\nIn trying to figure this out I wrote the following simple test program. I simply want it to open a form on a separate thread named \"UI thread\" and keep the thre...
How do I implement the singleton pattern in C#? I want to put my constants and some basic functions in it as I use those everywhere in my project. I want to have them 'Global' and not need to manually bind them every object I create.
The Singleton pattern is a design pattern that restricts the instantiation of a class to one single instance and provides a global point of access to it. In C#, you can implement the Singleton pattern in various ways, but one of the most common and thread-safe implementations is using a static property and a private co...
26,414
[ { "from": "human", "value": "How do I implement the singleton pattern in C#? I want to put my constants and some basic functions in it as I use those everywhere in my project. I want to have them 'Global' and not need to manually bind them every object I create.\n" }, { "from": "gpt", "value": ...
I quite often see JavaScript with variables that start with a dollar sign. When/why would you choose to prefix a variable in this way? (I'm not asking about $('p.foo') syntax that you see in jQuery and others, but normal variables like $name and $order)
In JavaScript, prefixing variable names with a dollar sign (`$`) is a common practice, but its use can vary depending on the context and coding conventions. Here are some reasons and scenarios where you might choose to use a dollar sign as a prefix for variable names: 1. **Indication of Special Variables**: Some devel...
27,665
[ { "from": "human", "value": "I quite often see JavaScript with variables that start with a dollar sign. When/why would you choose to prefix a variable in this way?\n(I'm not asking about $('p.foo') syntax that you see in jQuery and others, but normal variables like $name and $order)\n" }, { "from": ...
I'm trying to save some XML-Data in my UserSettings (Properties.Settings.Default.UserSettings) in a .NET Winforms Project. Is there a Possibility to do that or would it be better to save this Data in a seperated File? Thanks for your Answers!
In a .NET WinForms application, you have a couple of options for storing user settings. Whether to use `Properties.Settings.Default` or to save the XML data in a separate file depends on several factors, such as the complexity of your data, the size of the data, and how frequently it changes. Here’s a breakdown of both...
21,343
[ { "from": "human", "value": "I'm trying to save some XML-Data in my UserSettings (Properties.Settings.Default.UserSettings) in a .NET Winforms Project. Is there a Possibility to do that or would it be better to save this Data in a seperated File?\nThanks for your Answers!\n" }, { "from": "gpt", ...
How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux? I'm trying to look for the source of the datetime module in particular, but I'm interested in a more general answer as well.
To find the source file for a given Python module, you can use the `__file__` attribute of the module. This approach works on both Windows and Linux. Here’s a general way to find the source file for any Python module, including the `datetime` module: ### Steps to Find the Source File of a Python Module: 1. **Open a P...
28,750
[ { "from": "human", "value": "How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux?\nI'm trying to look for the source of the datetime module in particular, but I'm interested in a more general answer as well.\n" }, { "from": "g...
I'm writing a password encryption routine. I've written the below app to illustrate my problem. About 20% of the time, this code works as expected. The rest of the time, the decryption throws a cryptographic exception - "The data is invalid". I believe the problem is in the encryption portion, because the decryption...
The issue you are facing is related to how you are encoding and decoding the encrypted byte array. In your code, you are trying to convert the encrypted data, which is a byte array, back into a string using `Encoding.Unicode.GetString()`. This is incorrect because the encrypted data may contain byte values that don't c...
27,455
[ { "from": "human", "value": "I'm writing a password encryption routine. I've written the below app to illustrate my problem. About 20% of the time, this code works as expected. The rest of the time, the decryption throws a cryptographic exception - \"The data is invalid\".\nI believe the problem is in th...
Pretty simple question: When i have a persistable object, it usually has a property called ID (for abstract classes). So .. is the naming convention ID or Id? eg. public int ID { get; set; } or public int Id { get; set; } cheers :) PS. This is for .NET btw. FXCop conformat would be a bonus.
In .NET, the standard naming convention for properties is to use PascalCase. Therefore, the appropriate naming for an ID property would be `Id`. ```csharp public int Id { get; set; } ``` Using `ID` (all uppercase) is not typically recommended as it goes against the common PascalCase convention used for property names...
32,720
[ { "from": "human", "value": "Pretty simple question: When i have a persistable object, it usually has a property called ID (for abstract classes).\nSo .. is the naming convention ID or Id?\neg.\npublic int ID { get; set; }\n\nor\npublic int Id { get; set; }\n\ncheers :)\nPS. This is for .NET btw. FXCop conf...
How do you handle update refresh rate from your worker function to your UI ? Sending everything to the UI or maybe using a timer (from which side ? worker or UI ?)
Handling update refresh rates between a worker function and a UI can be approached in several ways, depending on the architecture of your application and the technologies you are using. Here are some common strategies: ### 1. **Event-Driven Updates** You can set up an event-driven architecture where the worker notifie...
25,965
[ { "from": "human", "value": "How do you handle update refresh rate from your worker function to your UI ?\nSending everything to the UI or maybe using a timer (from which side ? worker or UI ?)\n" }, { "from": "gpt", "value": "Handling update refresh rates between a worker function and a UI can ...
Ok, so I have this regex: ( |^|>)(((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{2})(-)?( )?)?)([0-9]{7}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{3})(-)?( )?)?)([0-9]{6}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{1})(-)?( )?)?)([0-9]{8})))( |$|<) It formats Dutch and Belgian phone numbers (I only want those hence the 3...
Your regex can be quite complex due to the specific requirements of validating Dutch and Belgian phone numbers, but we can attempt to simplify it by reducing redundancy and restructuring the logic. The use of non-capturing groups and better grouping can help simplify the regex without losing the necessary validation ru...
28,367
[ { "from": "human", "value": "Ok, so I have this regex:\n( |^|>)(((((((\\+|00)(31|32)( )?(\\(0\\))?)|0)([0-9]{2})(-)?( )?)?)([0-9]{7}))|((((((\\+|00)(31|32)( )?(\\(0\\))?)|0)([0-9]{3})(-)?( )?)?)([0-9]{6}))|((((((\\+|00)(31|32)( )?(\\(0\\))?)|0)([0-9]{1})(-)?( )?)?)([0-9]{8})))( |$|<)\n\nIt formats Dutch and...
A similar question discusses __construct, but I left it in my title for people searching who find this one. Apparently, __get and __set take a parameter that is the variable being gotten or set. However, you have to know the variable name (eg, know that the age of the person is $age instead of $myAge). So I don't see t...
The `__get`, `__set`, and `__call` magic methods in PHP provide a way to control how object properties and methods are accessed and modified, enabling you to implement dynamic behaviors and provide encapsulation. ### Why and When to Use `__get` and `__set` 1. **Encapsulation**: These methods allow you to control acce...
25,738
[ { "from": "human", "value": "A similar question discusses __construct, but I left it in my title for people searching who find this one.\nApparently, __get and __set take a parameter that is the variable being gotten or set. However, you have to know the variable name (eg, know that the age of the person is...
I decided to learn C++ (I program in C at work), and I have been reading some tutorials (and lots of posts here on Stack Overflow). OK, so I typed in the standard C++ "hello word", compiled with GCC on my Ubuntu machine as "test". Then I tried to run it by typing "test" and hitting enter. Nothing. It turns out I must r...
You're correct in your understanding that `./` indicates that the executable is located in the current directory. In Unix-like operating systems, including Ubuntu, the current directory (denoted by `.`) is not included in the system's `PATH` environment variable for security reasons. Here's a bit more detail on why th...
29,070
[ { "from": "human", "value": "I decided to learn C++ (I program in C at work), and I have been reading some tutorials (and lots of posts here on Stack Overflow). OK, so I typed in the standard C++ \"hello word\", compiled with GCC on my Ubuntu machine as \"test\".\nThen I tried to run it by typing \"test\" a...
I'm trying to access the Reporting Services via Web Services in my Visual Studio 2008 Application. How/where can I find my WSDL?
To access SQL Server Reporting Services (SSRS) through Web Services in your Visual Studio 2008 application, you will need the Web Service Description Language (WSDL) to interact with the SSRS APIs. Here's how you can find the WSDL for SSRS: ### Steps to Locate SSRS WSDL 1. **Check the SSRS URL**: The WSDL for SQL ...
25,192
[ { "from": "human", "value": "I'm trying to access the Reporting Services via Web Services in my Visual Studio 2008 Application. How/where can I find my WSDL? \n" }, { "from": "gpt", "value": "To access SQL Server Reporting Services (SSRS) through Web Services in your Visual Studio 2008 applica...
Working with TCL and I'd like to implement something like the Strategy Pattern. I want to pass in the "strategy" for printing output in a TCL function, so I can easily switch between printing to the screen and printing to a log file. What's the best way to do this in TCL?
In TCL, you can implement the Strategy Pattern by defining a set of procedures that represent different strategies for printing output. You can then pass a strategy as a parameter to a function that handles the output. Here’s a simple example to demonstrate how you can achieve this: ### Step 1: Define Printing Strateg...
27,076
[ { "from": "human", "value": "Working with TCL and I'd like to implement something like the Strategy Pattern. I want to pass in the \"strategy\" for printing output in a TCL function, so I can easily switch between printing to the screen and printing to a log file. What's the best way to do this in TCL?\n"...
I'm reading The C++ Programming Language and in it Stroustrup states that the int value of a char can range from 0 to 255 or -127 to 127, depending on implementation. Is this correct? It seems like it should be from -128 to 127. If not, why are their only 255 possible values in the second implementation possibility, n...
In C++, the representation of `char` types can indeed vary between implementations. Here’s a more detailed explanation of what you might find regarding the `char` data type: 1. **Types of `char`**: In C++, there are three types of `char`: `char`, `signed char`, and `unsigned char`. The behavior of `char` can be either...
30,256
[ { "from": "human", "value": "I'm reading The C++ Programming Language and in it Stroustrup states that the int value of a char can range from 0 to 255 or -127 to 127, depending on implementation. Is this correct? It seems like it should be from -128 to 127. If not, why are their only 255 possible values in...
Is there a PHP class/library that would allow me to query an XHTML document with CSS selectors? I need to scrape some pages for data that is very easily accessible if I could somehow use CSS selectors (jQuery has spoiled me!). Any ideas?
Yes, there are several PHP libraries that allow you to query XHTML documents using CSS selectors. One of the most popular and widely used libraries for this purpose is **Symfony DomCrawler**. It's part of the Symfony components, and it allows you to easily traverse and manipulate HTML and XML documents using CSS select...
27,602
[ { "from": "human", "value": "Is there a PHP class/library that would allow me to query an XHTML document with CSS selectors? I need to scrape some pages for data that is very easily accessible if I could somehow use CSS selectors (jQuery has spoiled me!). Any ideas?\n" }, { "from": "gpt", "value...
I've been struggling with a problem for the past couple days and haven't found a solution. I have an Visual Studio solution with 2 projects, the first one is a DLL with my business objects and logic, the other project is my WinForm application, and a reference dependency on the first project. I initially wrote the busi...
The `InvalidOperationException: Mapping Problem: Cannot find type 'Org.Example.System.Material' from mapping` error you are encountering suggests that your LINQ to SQL mapping configuration is unable to locate the `Material` class in your business logic DLL. This is a common issue when the mapping is not correctly conf...
26,856
[ { "from": "human", "value": "I've been struggling with a problem for the past couple days and haven't found a solution.\nI have an Visual Studio solution with 2 projects, the first one is a DLL with my business objects and logic, the other project is my WinForm application, and a reference dependency on the...
We need to remotely create an Exchange 2007 distribution list from Asp.Net. Near as I can tell, the only way to create a distribution list in the GAL is via the exchange management tools. Without installing this on our web server, is there any way to create a distribution list remotely? There are some third party com...
You are correct that Exchange 2007 distribution lists are essentially Active Directory (AD) group objects with specific Exchange attributes. While there is no direct Exchange Web Services (EWS) API to create distribution lists, you can use the Active Directory Service Interfaces (ADSI) or System.DirectoryServices names...
26,352
[ { "from": "human", "value": "We need to remotely create an Exchange 2007 distribution list from Asp.Net.\nNear as I can tell, the only way to create a distribution list in the GAL is via the exchange management tools. Without installing this on our web server, is there any way to create a distribution list...
I'm writing code like this, doing a little quick and dirty timing: var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < 1000; i++) { b = DoStuff(s); } sw.Stop(); Console.WriteLine(sw.ElapsedMilliseconds); Surely there's a way to call this bit of timing code as a fancy-schmancy .NET 3.0 lambda rather than (God...
Yes, you can achieve this in a more elegant way by using a lambda expression to encapsulate your timing code. In .NET, you can define a method that accepts a `Func<T>` or `Action` delegate representing the operation you want to time. Here's how you can do it: ```csharp using System; using System.Diagnostics; public c...
28,682
[ { "from": "human", "value": "I'm writing code like this, doing a little quick and dirty timing:\nvar sw = new Stopwatch();\nsw.Start();\nfor (int i = 0; i < 1000; i++)\n{\n b = DoStuff(s);\n}\nsw.Stop();\nConsole.WriteLine(sw.ElapsedMilliseconds);\n\nSurely there's a way to call this bit of timing code a...
I am calling a PHP-Script belonging to a MySQL/PHP web application using FF3. I run XAMPP on localhost. All I get is this: Connection Interrupted The connection to the server was reset while the page was loading. The network link was interrupted while negotiating a connection. Please try again.
The "Connection Interrupted" error you are experiencing when trying to call a PHP script in a MySQL/PHP web application using Firefox (FF3) suggests that there may be an issue with your local XAMPP setup, the PHP script itself, or the configuration. Here are several steps you can take to troubleshoot and resolve the is...
18,450
[ { "from": "human", "value": "I am calling a PHP-Script belonging to a MySQL/PHP web application using FF3. I run XAMPP on localhost. All I get is this:\n\nConnection Interrupted\n The connection to the server was reset while the page was loading.\n The network link was interrupted while negotiating a conn...
What would you suggest would be the best operating system for a web server? If possible, please enumerate the advantages and disadvantages if there are any...
Choosing the best operating system for a web server depends on various factors including performance, security, ease of use, community support, and the specific technologies you plan to run. Here are some popular operating systems for web servers, along with their advantages and disadvantages: ### 1. **Linux (e.g., Ub...
20,787
[ { "from": "human", "value": "What would you suggest would be the best operating system for a web server?\nIf possible, please enumerate the advantages and disadvantages if there are any...\n" }, { "from": "gpt", "value": "Choosing the best operating system for a web server depends on various fac...
I have a form that has multiple fields, and for testing purposes is there a way I could print out the values entered in all the fields, without having to individually print each value.
Yes, you can print out the values entered in multiple fields using different programming languages or frameworks, depending on how your form is structured (e.g., HTML with JavaScript, a web framework like Flask/Django for Python, etc.). Below are a few examples for different scenarios. ### Using JavaScript with HTML F...
27,956
[ { "from": "human", "value": "I have a form that has multiple fields, and for testing purposes is there a way I could print out the values entered in all the fields, without having to individually print each value.\n" }, { "from": "gpt", "value": "Yes, you can print out the values entered in mult...
This has been bugging me for a long time -- how do I properly resolve a merge conflict within the SVN properties set on a directory? Say for instance there are two developers working on a project where svn:ignore is set on some directory. If both developers make changes to this property, when the second one updates, ...
Resolving merge conflicts in SVN properties like `svn:ignore` or `svn:externals` can indeed be a bit cumbersome, especially when working in a team. Here’s a step-by-step approach to handle these conflicts more efficiently: 1. **Update Your Working Copy**: Before starting the merge, ensure that your working copy is up ...
26,259
[ { "from": "human", "value": "This has been bugging me for a long time -- how do I properly resolve a merge conflict within the SVN properties set on a directory? Say for instance there are two developers working on a project where svn:ignore is set on some directory. If both developers make changes to thi...
I have a public facing website that has been receiving a number of SQL injection attacks over the last few weeks. I exclusively use parameterised stored procedures so I believe that there has been no successful attacks, but a recent log showed an interesting technique: Line breaks added for clarity http://www.mydummy...
The SQL injection attack you've posted uses a technique involving a combination of SQL commands that are executed on the database server. Let’s break down the key components of what is happening: 1. **Basic Structure**: The attack starts with a standard SQL injection pattern, where the attacker is trying to append add...
27,879
[ { "from": "human", "value": "I have a public facing website that has been receiving a number of SQL injection attacks over the last few weeks. I exclusively use parameterised stored procedures so I believe that there has been no successful attacks, but a recent log showed an interesting technique:\nLine br...
Are there any third party enterprisey data grid controls out there, alla JIDE Data Grid? Is there a website like torry.net that lists third party java controls? Google doesn't turn up much for and I thought there would be a lot of both considering how popular java seems to be. TIA
Yes, there are several third-party enterprise-level data grid controls available for Java applications, similar to JIDE Data Grid. Below are some notable options, as well as a few resources where you can find various Java controls: ### Third-Party Data Grid Controls 1. **JIDE Software**: Besides their Data Grid, JIDE ...
26,971
[ { "from": "human", "value": "Are there any third party enterprisey data grid controls out there, alla JIDE Data Grid? Is there a website like torry.net that lists third party java controls? Google doesn't turn up much for and I thought there would be a lot of both considering how popular java seems to be.\n...
My question is the following. I have xml that is versioned by a namespace. I want to serialize this received xml into the appropriate object, but the only way I know to do this means I have to process the xml two times. First to discover the namespace, and then in order to serialize to the object of the proper type b...
Your approach involves parsing the XML twice: once to determine the namespace and again to deserialize it. While it's a common approach, there are definitely ways to streamline the process. ### Improved Approach One way to reduce redundancy is to create a single method that will handle both determining the type and d...
21,410
[ { "from": "human", "value": "My question is the following.\nI have xml that is versioned by a namespace. I want to serialize this received xml into the appropriate object, but the only way I know to do this means I have to process the xml two times. First to discover the namespace, and then in order to se...
Duplicate: What happens if you call erase on a map element while iterating from begin to end How to filter items from a stdmap I have a map map1<string,vector<string>> i have a iterator for this map "itr". i want to delete the entry from this map which is pointed by "itr". i can use the function map1.erase(itr); afte...
When you erase an element from a `std::map` using an iterator, that iterator becomes invalidated. To continue iterating through the map after an element has been erased, you need to retrieve the next valid iterator before performing the erase operation. Here’s how you can achieve this: 1. **Get the next iterator befo...
28,544
[ { "from": "human", "value": "Duplicate:\n\nWhat happens if you call erase on a map element while iterating from begin to end\nHow to filter items from a stdmap\n\nI have a map map1<string,vector<string>> i have a iterator for this map \"itr\".\ni want to delete the entry from this map which is pointed by \"...
We need to implement a large-scale key-value store (let's say up to 500GB) and BerkeleyDB seemed like it might be a decent option, but we would really like it to be network accessible. This led me to look at memcachedb. I haven't found much on the web where people talk about actual experiences with memcachedb, so my qu...
Hi Francis, When considering a large-scale key-value store, memcachedb can indeed be an option, but there are several factors to consider based on its architecture and capabilities. Here are some insights based on general knowledge and community feedback: ### Pros of Using memcachedb: 1. **Integration with Memcached*...
28,610
[ { "from": "human", "value": "We need to implement a large-scale key-value store (let's say up to 500GB) and BerkeleyDB seemed like it might be a decent option, but we would really like it to be network accessible. This led me to look at memcachedb. I haven't found much on the web where people talk about act...
I was recently asked to come up with a script that will allow the end user to upload a PSD (Photoshop) file, and split it up and create images from each of the layers. I would love to stay with PHP for this, but I am open to Python or Perl as well. Any ideas would be greatly appreciated.
To split a PSD (Photoshop Document) file into its individual layers and create images from each layer using PHP, Python, or Perl, you have different approaches depending on the language you choose. ### PHP Approach In PHP, you can use the `psd` library to read PSD files. However, this library may not support all feat...
13,286
[ { "from": "human", "value": "I was recently asked to come up with a script that will allow the end user to upload a PSD (Photoshop) file, and split it up and create images from each of the layers.\nI would love to stay with PHP for this, but I am open to Python or Perl as well.\nAny ideas would be greatly a...
Assuming a Read Committed Snapshot transaction isolation setting, is the following statement "atomic" in the sense that you won't ever "lose" a concurrent increment? update mytable set counter = counter + 1 I would assume that in the general case, where this update statement is part of a larger transaction, that it wo...
In the context of a database that uses Read Committed Snapshot Isolation (RCSI), the behavior of the update operation you described can lead to issues with concurrent increments if not handled correctly. Let's unpack your question: ### Atomicity and Concurrent Updates 1. **Atomicity**: When you say "atomic," you are ...
28,068
[ { "from": "human", "value": "Assuming a Read Committed Snapshot transaction isolation setting, is the following statement \"atomic\" in the sense that you won't ever \"lose\" a concurrent increment?\nupdate mytable set counter = counter + 1\n\nI would assume that in the general case, where this update state...
I recently added JQuery's date-picker control to a project. In Internet Exploder, I get the following error message: Internet Explorer cannot open the Internet site http://localhost/ Operation aborted What is causing this problem?
The "Operation aborted" error in Internet Explorer is a somewhat generic error that can occur for a variety of reasons when the browser encounters a problem while trying to navigate to or load a web page. In the context of using jQuery's date-picker, here are some potential causes and solutions: 1. **JavaScript Errors...
29,631
[ { "from": "human", "value": "I recently added JQuery's date-picker control to a project. In Internet Exploder, I get the following error message:\n\nInternet Explorer cannot open the\n Internet site\nhttp://localhost/\nOperation aborted\n\nWhat is causing this problem?\n" }, { "from": "gpt", "v...
This must be a classic .NET question for anyone migrating from Java. .NET does not seem to have a direct equivalent to java.io.StreamTokenizer, however the JLCA provides a SupportClass that attempts to implement it. I believe the JLCA also provides a Tokenizer SupportClass that takes a String as the source, which I ...
In .NET, there isn't a direct equivalent to Java's `StreamTokenizer`, which allows for tokenizing input from streams or strings in a very flexible way. However, you can achieve similar functionality using existing classes and libraries in .NET. Here's how you can tokenize both streams and strings effectively. ### Toke...
22,020
[ { "from": "human", "value": "This must be a classic .NET question for anyone migrating from Java. \n.NET does not seem to have a direct equivalent to java.io.StreamTokenizer, however the JLCA provides a SupportClass that attempts to implement it. I believe the JLCA also provides a Tokenizer SupportClass t...
Since a lot of email clients ignore the HEAD tag, can I embed an inline stylesheet in the body?
While it's technically possible to embed styles directly within the `<body>` of an HTML email, most email clients will not properly support it. The best practice for styling HTML emails is to use inline styles directly on the elements you want to style. Here's why using inline styles is recommended: 1. **Compatibilit...
31,240
[ { "from": "human", "value": "Since a lot of email clients ignore the HEAD tag, can I embed an inline stylesheet in the body?\n" }, { "from": "gpt", "value": "While it's technically possible to embed styles directly within the `<body>` of an HTML email, most email clients will not properly suppor...
In a program I work on, I have a lot of code as follows: pthread_mutex_lock( &frame->mutex ); frame->variable = variable; pthread_mutex_unlock( &frame->mutex ); This is clearly a waste of CPU cycles if the middle instruction can just be replaced with an atomic store. I know that gcc is quite capable of this, but I ha...
To replace the mutex lock and unlock operations with atomic operations for simple thread-safe storage, you can use atomic types provided by the C11 standard or the C++11 standard library if you are using C++. ### Using C11 `stdatomic.h` If you are compiling with a C11 compatible compiler, you can use the `<stdatomic....
23,501
[ { "from": "human", "value": "In a program I work on, I have a lot of code as follows:\npthread_mutex_lock( &frame->mutex );\nframe->variable = variable;\npthread_mutex_unlock( &frame->mutex );\n\nThis is clearly a waste of CPU cycles if the middle instruction can just be replaced with an atomic store. I kn...
I have a simple page that has some iframe sections (to display RSS links). How can I apply the same CSS format from the main page to the page displayed in the iframe?
To apply the same CSS format from the main page to the content displayed in an iframe, you have a few options depending on how much control you have over the content inside the iframe. ### 1. Same-Origin Policy First, it's important to note that due to the Same-Origin Policy, you can only manipulate the contents of a...
22,994
[ { "from": "human", "value": "I have a simple page that has some iframe sections (to display RSS links). How can I apply the same CSS format from the main page to the page displayed in the iframe?\n" }, { "from": "gpt", "value": "To apply the same CSS format from the main page to the content disp...