instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am trying to do some simple formatting stuff with 'sed' in linux, and i need to use a regex to trim a string after the 15th character, and append a '...' to the end. Something like this: before: this is a long string that needs to be shortened after: this is a long ... Can anyone please show me how i could write thi...
Certainly! You can use `sed` to accomplish this task in Linux. Here’s how you can trim a string to the first 15 characters and append `...` to the end. The `sed` command you'd use is: ```bash echo "this is a long string that needs to be shortened" | sed 's/^.\{15\}.*/&.../' ``` ### Explanation of the Command 1. **`...
43,169
[ { "from": "human", "value": "I am trying to do some simple formatting stuff with 'sed' in linux, and i need to use a regex to trim a string after the 15th character, and append a '...' to the end. Something like this:\nbefore: this is a long string that needs to be shortened\nafter: this is a long ...\n\nCa...
We have a legacy ASP.net powered site running on a IIS server, the site was developed by a central team and is used by multiple customers. Each customer however has their own copy of the site's aspx files plus a web.config file. This is causing problems as changes made by well meaning support engineers to the copies o...
To refactor your ASP.NET application so that each customer shares a common set of source files while having individual configuration settings, you can adopt a structure that leverages ASP.NET's configuration system. Here's a step-by-step approach to achieve your goal: ### Step 1: Restructure Your Application 1. **Cre...
41,126
[ { "from": "human", "value": "We have a legacy ASP.net powered site running on a IIS server, the site was developed by a central team and is used by multiple customers. Each customer however has their own copy of the site's aspx files plus a web.config file. This is causing problems as changes made by well ...
I want to know what is the difference between a query and a view in terms of performance. And if a view is costly, what else besides a query could I do to improve performance?
When comparing a query and a view in terms of performance, there are several aspects to consider: ### Query vs. View 1. **Definition**: - A **query** is a command or statement that retrieves data from a database, typically written in SQL. It can be ad-hoc and vary each time it is executed. - A **view** is a vir...
39,082
[ { "from": "human", "value": "I want to know what is the difference between a query and a view in terms of performance. And if a view is costly, what else besides a query could I do to improve performance?\n" }, { "from": "gpt", "value": "When comparing a query and a view in terms of performance,...
Is it possible to embed the Windows Explorer file/folder browser view in a WPF or a WinForms window? I basically want to host the file/folder browser as part of my app window. I don't want to re-implement what the shell provides, especially the shell extensions such as TortoiseSVN.
Yes, it's possible to embed the Windows Explorer file/folder browser in a WPF or WinForms application, although it requires some workarounds since there is no direct support for embedding Windows Explorer in .NET applications. Below are two approaches, one for WPF and one for WinForms. ### Using Windows API (SHDocVw) ...
39,442
[ { "from": "human", "value": "Is it possible to embed the Windows Explorer file/folder browser view in a WPF or a WinForms window?\nI basically want to host the file/folder browser as part of my app window. I don't want to re-implement what the shell provides, especially the shell extensions such as Tortois...
I am getting 'trailing whitespace' errors trying to commit some files in Git. I want to remove these trailing whitespace characters automatically right before I save Python files. Can you configure Vim to do this? If so, how?
Yes, you can configure Vim to automatically remove trailing whitespace when saving Python files. You can do this by adding an autocmd (automatic command) to your Vim configuration file (`.vimrc`). Here’s how to set it up: 1. Open your `.vimrc` file. You can do this by running the following command in your terminal: ...
43,667
[ { "from": "human", "value": "I am getting 'trailing whitespace' errors trying to commit some files in Git.\nI want to remove these trailing whitespace characters automatically right before I save Python files.\nCan you configure Vim to do this? If so, how?\n" }, { "from": "gpt", "value": "Yes, y...
From a programmer stuck in the web world... What are the most common desktop development "frameworks" currently being used for desktop application development? Is it realistic to write desktop software for both Windows and OS X? Is it realistic to use the same base code to write the business/data layers for an applica...
As of my last update, here are some of the most common frameworks and technologies used for desktop application development: ### Common Desktop Development Frameworks 1. **Electron**: A popular framework that allows for the development of cross-platform desktop applications using web technologies (HTML, CSS, JavaScri...
43,426
[ { "from": "human", "value": "From a programmer stuck in the web world...\nWhat are the most common desktop development \"frameworks\" currently being used for desktop application development?\n\nIs it realistic to write desktop software for both Windows and OS X?\nIs it realistic to use the same base code t...
I would like to create infrastructure to handle events for my opengl project. It should be similar to what wpf has - 3 types of events - direct, tunneling, bubbling. I then want to handle events such as mouse up, down, move etc. How should i approach this problem? Is there any library to handle this. thanks
Creating an event handling system for your OpenGL project that mimics WPF's event model (direct, tunneling, and bubbling) is a challenging but rewarding task. Here’s a structured approach to designing and implementing this system. ### 1. Understanding WPF Event Model Before you start coding, it's important to underst...
38,972
[ { "from": "human", "value": "I would like to create infrastructure to handle events for my opengl project.\nIt should be similar to what wpf has - 3 types of events - direct, tunneling, bubbling.\nI then want to handle events such as mouse up, down, move etc.\nHow should i approach this problem? Is there an...
This Question asked about embedding a flash player in .net. The provided answer is to host the ActiveX Flash player on the form. This works for simple things, like playing a flash movie. But what if you want to provide data hosted by the .net application to a flex application? Is there an efficient way to transport dat...
To efficiently transport data from a .NET application to a Flex (or Flash) application, you can use several techniques to enable communication between the two. Here are some common methods you can consider: ### 1. **ExternalInterface**: If you are hosting the Flex application in a web browser, you can use the `Externa...
40,217
[ { "from": "human", "value": "This Question asked about embedding a flash player in .net. The provided answer is to host the ActiveX Flash player on the form.\nThis works for simple things, like playing a flash movie. But what if you want to provide data hosted by the .net application to a flex application? ...
The library should; Be easy to use and few lines of client code should accomplish much Be as platform independent as possible. (In case of future ports to other platforms) Have C++ bindings. Be mature and stable I would also like to be notified of most HID events through callbacks. I have considered the following alt...
Based on your requirements for a HID (Human Interface Device) library, here are some alternatives you might consider: ### 1. **hidapi** - **Description**: `hidapi` is a simple and easy-to-use library for communicating with USB HID devices. - **Features**: - Cross-platform support (Windows, macOS, Linux). - C and ...
42,122
[ { "from": "human", "value": "The library should;\n\nBe easy to use and few lines of client code should accomplish much\nBe as platform independent as possible. (In case of future ports to other platforms)\nHave C++ bindings.\nBe mature and stable\n\nI would also like to be notified of most HID events throug...
I have an ASP website which I need to add a RegEx match to. Is there any support for RegEx in ASP/VBScript? Thank you, Brett
Yes, you can use Regular Expressions in ASP (Active Server Pages) with VBScript. ASP provides access to regular expressions through the `Microsoft VBScript Regular Expressions` library. Here’s how you can use it: 1. **Create a Regular Expression Object**: You need to create an instance of the RegExp object. 2. **Set ...
42,815
[ { "from": "human", "value": "I have an ASP website which I need to add a RegEx match to. Is there any support for RegEx in ASP/VBScript?\nThank you,\nBrett\n" }, { "from": "gpt", "value": "Yes, you can use Regular Expressions in ASP (Active Server Pages) with VBScript. ASP provides access to re...
I have a file with several thousand rows and several columns separated with tabs What I'd like to do is loop through each individually, Drop the columns into an array so that I can place them in another application individually, then move onto the next line. Unfortunately I got about as far as this: Open mytextfile.tx...
To break each line of your tab-separated file into an array, you can use the `Split` function in VB (Visual Basic). The `Split` function allows you to divide a string into an array based on a specified delimiter, which in your case is a tab character. Here's how you can modify your existing code to achieve this: ```v...
42,556
[ { "from": "human", "value": "I have a file with several thousand rows and several columns separated with tabs What I'd like to do is loop through each individually, Drop the columns into an array so that I can place them in another application individually, then move onto the next line. Unfortunately I got...
E.g. What's best out of these: std::string f() {} or const std::string& f() {}
The choice between returning a `std::string` by value (`std::string f() {}`) and returning a `const std::string&` (`const std::string& f() {}`) depends on the context of how the function will be used and the intended semantics of your API. Here are some considerations for both approaches: ### 1. Returning `std::string...
41,463
[ { "from": "human", "value": "E.g.\nWhat's best out of these:\nstd::string f() {} \n\nor \nconst std::string& f() {}\n\n" }, { "from": "gpt", "value": "The choice between returning a `std::string` by value (`std::string f() {}`) and returning a `const std::string&` (`const std::string& f() {}`) d...
There is a space of x*y for text to go on $im (GD Image Resource) how can I choose a font size (or write text such that) it does not overflow over that area?
To ensure that your text fits within a specific area defined by `x` (width) and `y` (height) in a GD Image Resource, you'll need to determine the appropriate font size based on the dimensions of the area and the text you want to render. Here’s a step-by-step guide on how to achieve this: 1. **Define the Area**: Establ...
40,458
[ { "from": "human", "value": "There is a space of x*y for text to go on $im (GD Image Resource) how can I choose a font size (or write text such that) it does not overflow over that area?\n" }, { "from": "gpt", "value": "To ensure that your text fits within a specific area defined by `x` (width) ...
Since there is apparently no Flash control that can accept bitmap pastes, I want to think about writing one myself. I'd rather not use Flash though, so I though about using .NET. Now I believe the correct terminology for a native code control that can be downloaded and run in the browser is "ActiveX control". So my que...
Creating an ActiveX control using .NET that allows for clipboard bitmap pasting in a web browser is technically feasible, but it comes with significant challenges and limitations, especially considering modern web security and usability standards. Here's a breakdown of your questions: ### 1. Creating a Control That Ca...
40,906
[ { "from": "human", "value": "Since there is apparently no Flash control that can accept bitmap pastes, I want to think about writing one myself. I'd rather not use Flash though, so I though about using .NET.\nNow I believe the correct terminology for a native code control that can be downloaded and run in t...
Here's my code: class Publisher(models.Model): name = models.CharField( max_length = 200, unique = True, ) url = models.URLField() def __unicode__(self): return self.name def save(self): pass class Item(models.Model): publisher = models.ForeignKey(Publ...
To achieve your goal of appending text to the `code` field of each `Item` associated with a `Publisher` when saving the `Publisher`, you need to override the `save` method in the `Publisher` model. However, you are encountering issues because the `Item` instances associated with the `Publisher` are not readily accessib...
43,143
[ { "from": "human", "value": "Here's my code:\nclass Publisher(models.Model):\n name = models.CharField(\n max_length = 200,\n unique = True,\n )\n\n url = models.URLField()\n\n def __unicode__(self):\n return self.name\n\n def save(self):\n pass\n\nclass It...
I recently ran into a issue where intermediate link betweeen a TCP server and client was down. The client has the requirement of connecting to a secondary server if the primary server is down. When the primary server is bought down (Ex ..by doing ^C on the terminal), there is TCP shutdown sequence that gets through and...
TCP Keepalive is a widely used mechanism to detect broken connections when there is a lack of data transmission between a client and a server, particularly in scenarios where an intermediate link might go down. However, while it is an effective solution, it is not the only one. Here are some alternative approaches you ...
43,575
[ { "from": "human", "value": "I recently ran into a issue where intermediate link betweeen a TCP server and client was down. The client has the requirement of connecting to a secondary server if the primary server is down. When the primary server is bought down (Ex ..by doing ^C on the terminal), there is TC...
The .net framework 3.5 (or vista) provides me with an English voice (David I think) to use with the Speech.Synthesis api. I need a french voice to use with a french dictation practice app I am building for my kids to use to improve their french spelling. The api allows me to change culture when creating a voice, but th...
If you're looking for free French text-to-speech (TTS) voices to use with the .NET Speech.Synthesis API, there are a few options to consider: 1. **Windows Language Packs**: If you have Windows 10 or later, you can install additional language packs, which often include TTS voices. Go to **Settings > Time & Language > L...
44,012
[ { "from": "human", "value": "The .net framework 3.5 (or vista) provides me with an English voice (David I think) to use with the Speech.Synthesis api. I need a french voice to use with a french dictation practice app I am building for my kids to use to improve their french spelling. The api allows me to cha...
Just came across this website. Feature 9 is memory management and they claim that their product "automatically releas[es] memory [that is] no longer needed." Is this a marketing ploy, or do you think they have some trick up their sleeves? Are they just making a claim based on what they .Net runtime provides in any case...
The claim about "automatically releasing memory no longer needed" is likely a reference to how memory management generally works in managed environments like the .NET runtime, which uses a garbage collector (GC) to automatically reclaim memory that is no longer in use. In .NET, the GC manages the allocation and dealloc...
42,963
[ { "from": "human", "value": "Just came across this website. Feature 9 is memory management and they claim that their product \"automatically releas[es] memory [that is] no longer needed.\"\nIs this a marketing ploy, or do you think they have some trick up their sleeves? Are they just making a claim based on...
When you assign a date to a named SQL parameter Hibernate automatically converts it to GMT time. How do you make it use the current server timezone for all dates? Lets say you have a query: Query q = session.createQuery("from Table where date_field < :now"); q.setDate("now", new java.util.Date()); "now" will be set to...
When working with Hibernate, it's important to handle date and time correctly, particularly when dealing with time zones. By default, Hibernate may convert date values to UTC (GMT), which can lead to discrepancies if your application is expecting local server time. To ensure that Hibernate uses the current server time...
41,170
[ { "from": "human", "value": "When you assign a date to a named SQL parameter Hibernate automatically converts it to GMT time. How do you make it use the current server timezone for all dates?\nLets say you have a query:\nQuery q = session.createQuery(\"from Table where date_field < :now\");\nq.setDate(\"now...
Is there an API to access Subversion from C#?
Yes, there are several options for accessing Subversion (SVN) repositories from C#. Here are a few of them: 1. **SharpSvn**: This is a .NET library that provides bindings for the Subversion client libraries. It allows you to interact with Subversion repositories programmatically from C#. You can perform operations suc...
42,863
[ { "from": "human", "value": "Is there an API to access Subversion from C#?\n" }, { "from": "gpt", "value": "Yes, there are several options for accessing Subversion (SVN) repositories from C#. Here are a few of them:\n\n1. **SharpSvn**: This is a .NET library that provides bindings for the Subver...
Is it possible to provide Unicode input to a console app, and read the Unicode char/string via Console.ReadKey()? I know Unicode works when reading the input via other methods, but unfortunately I need to use the 'interception' feature provided by ReadKey. Update: When pasting a Unicode character such as U+03BB (λ) int...
When working with console applications in .NET and trying to read Unicode input through `Console.ReadKey()`, you might encounter limitations due to how the console handles input. The console's input handling depends significantly on the code page and how special characters are interpreted. ### Understanding `Console.R...
43,481
[ { "from": "human", "value": "Is it possible to provide Unicode input to a console app, and read the Unicode char/string via Console.ReadKey()?\nI know Unicode works when reading the input via other methods, but unfortunately I need to use the 'interception' feature provided by ReadKey.\nUpdate:\nWhen pastin...
Here's my PS1 variable: PS1='\u:\W$(__git_ps1 "\e[32m\][%s]\e[0m\]")$ ' Works great for picking up my Git branch, but it has the unfortunate side-effect of wrapping the lines when the colours are active, so that they overlap when you use long commands. Can anyone with magic PS1 skills help me out to fix this?
The issue you're encountering with the PS1 variable is likely due to the fact that the escape sequences for colors are affecting the line length calculations in the terminal. To resolve this, you need to ensure that the terminal understands the lengths of your prompt correctly, which can be done using the special escap...
45,425
[ { "from": "human", "value": "Here's my PS1 variable:\nPS1='\\u:\\W$(__git_ps1 \"\\e[32m\\][%s]\\e[0m\\]\")$ '\n\nWorks great for picking up my Git branch, but it has the unfortunate side-effect of wrapping the lines when the colours are active, so that they overlap when you use long commands.\nCan anyone wi...
I need to query Active Directory for a list of users whose password is about to expire. The obvious (and easy) way to do this is with: dsquery user -stalepwd n The problem is that I need to add additional filters to only look for users who are in certain security groups. This is hard to do with the "dsquery user" s...
Filtering for users with passwords about to expire using `dsquery` with an LDAP filter can indeed be a bit tricky, especially since `dsquery` does not directly expose password age attributes in a way that's easy to filter. Unfortunately, the built-in LDAP attributes do not include a straightforward representation of p...
42,035
[ { "from": "human", "value": "I need to query Active Directory for a list of users whose password is about to expire. The obvious (and easy) way to do this is with:\ndsquery user -stalepwd n \n\nThe problem is that I need to add additional filters to only look for users who are in certain security groups. ...
If a hacker has access to the hashes in my DB, he has access to the rest of the information in the DB anyways. So why would he bother trying to decrypt the passwords? Should I be storing the passwords on a different server to the rest of my data? That is the only scenario in which I can envision it being useful.
You raise an interesting point regarding the security of hashed passwords in a database. Let's break down the considerations: ### 1. Hashing vs. Encryption - **Hashing**: Passwords should be stored as hashes (using algorithms like bcrypt, Argon2, or PBKDF2). Hashing is a one-way function, meaning that you cannot retri...
41,085
[ { "from": "human", "value": "If a hacker has access to the hashes in my DB, he has access to the rest of the information in the DB anyways. So why would he bother trying to decrypt the passwords? Should I be storing the passwords on a different server to the rest of my data? That is the only scenario in whi...
From the help for the Overflow Error in VBA, there's the following examples: Dim x As Long x = 2000 * 365 ' gives an error Dim x As Long x = CLng(2000) * 365 ' fine I would have thought that, since the Long data type is supposed to be able to hold 32-bit numbers, that the first example would work fine. I ask this bec...
The confusion you're facing arises from how VBA handles arithmetic operations and the types of values involved in those operations before they are assigned to a variable. In your first example: ```vba Dim x As Long x = 2000 * 365 ' gives an error ``` The multiplication `2000 * 365` is performed first, and since both...
43,098
[ { "from": "human", "value": "From the help for the Overflow Error in VBA, there's the following examples:\nDim x As Long\nx = 2000 * 365 ' gives an error\n\nDim x As Long\nx = CLng(2000) * 365 ' fine\n\nI would have thought that, since the Long data type is supposed to be able to hold 32-bit numbers, that t...
I'd like to use the ScriptManager and CompositeScript components in my master page to include site-wide javascript, but add to that list in my "Web Content Form". I'm sure that can be done in the code-behind, but optimally I'd like to do it in markup. Can this sort of thing be done? In: MasterPage.master <asp:ScriptMan...
Yes, you can add additional script references in your content pages using the `<asp:Content>` control without needing to modify the master page's code-behind. However, the script references from the content page need to be added in a way that ensures they're recognized correctly by the `ScriptManager` in the master pag...
41,781
[ { "from": "human", "value": "I'd like to use the ScriptManager and CompositeScript components in my master page to include site-wide javascript, but add to that list in my \"Web Content Form\". I'm sure that can be done in the code-behind, but optimally I'd like to do it in markup. Can this sort of thing be...
How can I extend a builtin class in python? I would like to add a method to the str class. I've done some searching but all I'm finding is older posts, I'm hoping someone knows of something newer.
In Python, you can extend built-in classes by creating a subclass of that class. To add a method to the `str` class, you can define a new class that inherits from `str` and then add your custom methods to that class. Here's an example of how you can do this: ```python class MyStr(str): def shout(self): ret...
44,721
[ { "from": "human", "value": "How can I extend a builtin class in python?\nI would like to add a method to the str class.\nI've done some searching but all I'm finding is older posts, I'm hoping someone knows of something newer.\n" }, { "from": "gpt", "value": "In Python, you can extend built-in ...
I have a Word document that starts with a Table of Contents. I need to break up the document into sections based on the Table of Contents. The Table of Contents has a section title and section number. How can I use VBA to split the document based on the section numbers/ name?
To split a Word document into separate files based on the sections defined in the Table of Contents (ToC), you can use VBA (Visual Basic for Applications). Below is a simple example of how you can achieve this: 1. **Prepare Your Document**: Ensure your Table of Contents is correctly formatted and that your document se...
39,711
[ { "from": "human", "value": "I have a Word document that starts with a Table of Contents. I need to break up the document into sections based on the Table of Contents. The Table of Contents has a section title and section number.\nHow can I use VBA to split the document based on the section numbers/ name?\n...
It seems as though the following calls do what you'd expect (close the stream and not allow any further input - anything waiting for input on the stream returns error), but is it guaranteed to be correct across all compilers/platforms? close(fileno(stdin)); fclose(stdin);
Using `close(fileno(stdin));` and `fclose(stdin);` has distinct implications, and whether they are correct across all compilers and platforms depends on several factors. ### Key Points to Consider 1. **Standard Library Definitions**: - In C and C++, `stdin` is defined as a file pointer to the standard input stream...
43,664
[ { "from": "human", "value": "It seems as though the following calls do what you'd expect (close the stream and not allow any further input - anything waiting for input on the stream returns error), but is it guaranteed to be correct across all compilers/platforms?\nclose(fileno(stdin));\nfclose(stdin);\n\n"...
I need to use a datetime.strptime on the text which looks like follows. "Some Random text of undetermined length Jan 28, 1986" how do i do this?
To parse a date from a string that contains random text followed by a date in the format "Jan 28, 1986", you can use the `datetime` module in Python. The `strptime` method is used to convert a date string to a `datetime` object based on a specified format. Here's how you can extract the date from the string and parse ...
42,929
[ { "from": "human", "value": "I need to use a datetime.strptime on the text which looks like follows.\n\"Some Random text of undetermined length Jan 28, 1986\"\nhow do i do this?\n" }, { "from": "gpt", "value": "To parse a date from a string that contains random text followed by a date in the for...
There's something wrong with my code or I'm just not understanding this fully. I have the following code that runs a query that MAY contain more than one RIGHT attribute and want to store each within an array for later fetching: var members = from myList in o_data.Descendants(bp + "Reaction") ...
The issue you're encountering is related to how anonymous types are being used in your LINQ query. When you create an anonymous type with a property named `participant`, you're effectively creating an object that holds that property. When you call `ToString()` on the array of these objects, it calls the default `ToStri...
42,747
[ { "from": "human", "value": "There's something wrong with my code or I'm just not understanding this fully. I have the following code that runs a query that MAY contain more than one RIGHT attribute and want to store each within an array for later fetching:\n var members = from myList in o_data.Desce...
Is it possible have a migration script automatically generate from a table schema in Doctrine? For example, during heavy development of new features, I will oftern build out my tables first while writing the initial code. I usually don't create a migration to start because the definition of the table may change as the...
Yes, it is indeed possible to generate migration scripts automatically in Doctrine, which can greatly simplify the development process, especially when working with new features and making frequent changes to the database schema. Doctrine provides a command-line tool that can help you with this task. You can use the `...
41,737
[ { "from": "human", "value": "Is it possible have a migration script automatically generate from a table schema in Doctrine?\nFor example, during heavy development of new features, I will oftern build out my tables first while writing the initial code. I usually don't create a migration to start because the...
I keep finding that if I have nested divs inside each other, and one of the inner ones is floated, the outer one won't expand around it. Example: <div style='background-color:red; '> asdfasdf <div style='float:left; background-color:blue; width:400px; height:400px;'> asdfasdfasdfasdfasdfasdfasdf<br /> ...
What you're encountering is a common issue in CSS known as "collapsing margins" or "float issues." When you float an element (like your inner `<div>`), it is taken out of the normal document flow, which means that its parent container (the outer `<div>`) doesn't automatically expand to encompass it. To make the outer ...
40,341
[ { "from": "human", "value": "I keep finding that if I have nested divs inside each other, and one of the inner ones is floated, the outer one won't expand around it.\nExample:\n<div style='background-color:red; '>\n asdfasdf\n <div style='float:left; background-color:blue; width:400px; height:400px;'>...
I need to share SSO information between two different domains with a cookie, can this be done in PHP and how?
Sharing Single Sign-On (SSO) information between two different domains using cookies can be tricky because of the same-origin policy implemented in web browsers. Generally, cookies are domain-specific, meaning a cookie set on one domain cannot be accessed by another domain. However, there are some workarounds and techn...
37,682
[ { "from": "human", "value": "I need to share SSO information between two different domains with a cookie, can this be done in PHP and how?\n" }, { "from": "gpt", "value": "Sharing Single Sign-On (SSO) information between two different domains using cookies can be tricky because of the same-origi...
How do you organize your stored procedures so you can easily find them and keep track of their dependencies?
Organizing stored procedures and managing their dependencies effectively is essential for maintaining a clean and efficient database environment. Here are some strategies and best practices to consider: ### 1. **Naming Conventions** - **Consistent Naming**: Use a clear and consistent naming convention that reflects...
40,854
[ { "from": "human", "value": "How do you organize your stored procedures so you can easily find them and keep track of their dependencies? \n" }, { "from": "gpt", "value": "Organizing stored procedures and managing their dependencies effectively is essential for maintaining a clean and efficient ...
What is a good crawler (spider) to use against HTML and XML documents (local or web-based) and that works well in the Lucene / Solr solution space? Could be Java-based but does not have to be.
For crawling HTML and XML documents, especially in conjunction with Apache Lucene and Solr, here are a few good options to consider: 1. **Apache Nutch**: - Apache Nutch is a highly extensible and scalable open-source web crawler. It is built on top of Apache Hadoop, making it a great choice for crawling large-scale...
38,192
[ { "from": "human", "value": "What is a good crawler (spider) to use against HTML and XML documents (local or web-based) and that works well in the Lucene / Solr solution space? Could be Java-based but does not have to be.\n" }, { "from": "gpt", "value": "For crawling HTML and XML documents, espe...
I can see line numbers in my error logs in our development environment, in which VB.NET 2005 and ASP.NET components are compiled in debug mode, with PDB files copied to the server on deployment. I don't see line numbers in production, where things are compiled in release mode, and presumably no PDB files are created or...
In VB.NET and ASP.NET development, debugging information such as line numbers is typically included in the compiled output when you compile your application in **Debug mode**. However, when you switch to **Release mode**, by default, the compiler optimizes the code and does not include the same level of debugging infor...
39,960
[ { "from": "human", "value": "I can see line numbers in my error logs in our development environment, in which VB.NET 2005 and ASP.NET components are compiled in debug mode, with PDB files copied to the server on deployment.\nI don't see line numbers in production, where things are compiled in release mode, ...
Is there a way to log(/var/log) commands executed by users in the Unix shell?
Yes, there are several ways to log commands executed by users in the Unix shell. Here are some common methods: ### 1. **Bash History Logging** By default, Bash maintains a history of commands executed by users in a file located at `~/.bash_history`. However, you can enhance this logging: - **Persistent History Acros...
43,697
[ { "from": "human", "value": "Is there a way to log(/var/log) commands executed by users in the Unix shell?\n" }, { "from": "gpt", "value": "Yes, there are several ways to log commands executed by users in the Unix shell. Here are some common methods:\n\n### 1. **Bash History Logging**\n\nBy defa...
A fairly basic question, but I don't see it asked anywhere. Let's say we have a global struct (in C) like so: struct foo { int written_frequently1; int read_only; int written_frequently2; }; It seems clear to me that if we have lots of threads reading and writing, we need a semaphore (or other lock) on the writt...
Your question touches on a few important concepts related to concurrency and memory access in C, particularly regarding how struct members interact with each other in a multithreaded environment. ### Understanding Struct Memory Layout In C, the members of a struct are laid out in memory sequentially. This means that ...
41,144
[ { "from": "human", "value": "A fairly basic question, but I don't see it asked anywhere.\nLet's say we have a global struct (in C) like so:\nstruct foo {\n int written_frequently1;\n int read_only;\n int written_frequently2;\n};\n\nIt seems clear to me that if we have lots of threads reading and writing,...
I need to get a file from sourcesafe database programmatically. Any idea of how to do it? ps: I'll do that by using C#.
To retrieve a file from a SourceSafe database programmatically using C#, you can use the SourceSafe automation API. This approach allows you to interact with the SourceSafe database as if you were using the graphical user interface. ### Steps to Retrieve a File from SourceSafe Using C# 1. **Add a Reference to the Sou...
42,260
[ { "from": "human", "value": "I need to get a file from sourcesafe database programmatically. Any idea of how to do it? \nps: I'll do that by using C#.\n" }, { "from": "gpt", "value": "To retrieve a file from a SourceSafe database programmatically using C#, you can use the SourceSafe automation A...
I'm using Apache JMeter 2.3, which now supports "attempt HTTPS spoofing" under the Proxy Server element. I've tried this on several different servers, and have had no success. Has anyone been able to successfully record from an HTTPS source with this setting? Or barring successfully recording, can anyone share a work...
Using Apache JMeter 2.3 with HTTPS spoofing can indeed be challenging, especially since this version is quite outdated. However, there are a few steps you can follow to successfully record HTTPS traffic. Here are some tips and a workaround that you can consider: ### Steps to Record HTTPS Traffic with JMeter: 1. **Con...
42,553
[ { "from": "human", "value": "I'm using Apache JMeter 2.3, which now supports \"attempt HTTPS spoofing\" under the Proxy Server element. \nI've tried this on several different servers, and have had no success. \nHas anyone been able to successfully record from an HTTPS source with this setting?\nOr barring s...
I am having severe performance issues when compiling a moderately large ASP.Net website in Visual Studio 2008 (targeting .Net 3.5). I know there are some tips & registry hacks for improving compilation performance in VS 2005, are there any for VS 2008? Specifically, it seems that VS 2008 is compiling the whole website ...
When dealing with performance issues while compiling an ASP.NET website in Visual Studio 2008, there are several approaches you can take to improve the compilation time. Here are some tips and considerations that might help: 1. **Use Web Application Project instead of Web Site Project**: - If you are using a Web Si...
43,115
[ { "from": "human", "value": "I am having severe performance issues when compiling a moderately large ASP.Net website in Visual Studio 2008 (targeting .Net 3.5). I know there are some tips & registry hacks for improving compilation performance in VS 2005, are there any for VS 2008? Specifically, it seems tha...
I've been developing business apps, basically CRUD, in ASP.Net for years now, and am interested in learning another language and platform. After a few trips to Borders and poking around a bit on the web, I have not found much dealing with generating reports in Ruby / Ruby on Rails apps. These reports would include thi...
Hello Mike, It's great that you're looking to expand your skill set into Ruby on Rails! Generating reports in Ruby on Rails applications can be accomplished through a variety of methods and libraries. Here are some approaches and tools you might find helpful: ### 1. **Built-in Ruby Libraries** - **Prawn**: Prawn is a...
41,287
[ { "from": "human", "value": "I've been developing business apps, basically CRUD, in ASP.Net for years now, and am interested in learning another language and platform.\nAfter a few trips to Borders and poking around a bit on the web, I have not found much dealing with generating reports in Ruby / Ruby on Ra...
I have two Tables. Order - With Columns OrderID, OrderStatusID OrderStatus - With Columns OrderStatusID, Description I have an Order Object which calls to the database and fills its properties for use in my code. Right now I have access to Order.OrderStatusID, but in my application I really need access to the "Descrip...
To elegantly handle the requirement of accessing the `Description` field from the `OrderStatus` table while maintaining good object-oriented design principles, you can follow these steps: ### Step 1: Create a Domain Model First, create a domain model that represents both `Order` and `OrderStatus`. This keeps your dat...
42,036
[ { "from": "human", "value": "I have two Tables.\nOrder - With Columns OrderID, OrderStatusID\nOrderStatus - With Columns OrderStatusID, Description\nI have an Order Object which calls to the database and fills its properties for use in my code. Right now I have access to Order.OrderStatusID, but in my appl...
How do I export all of the names and email addresses from a distribution list in Outlook using code? I have access to an Outlook 2000 or Outlook 2007 client. Ideally I would like the code to be in C#.
To export all names and email addresses from a distribution list in Outlook using C#, you can use the Outlook Interop library. Below is a sample code that demonstrates how to access a distribution list from Outlook and export its members' names and email addresses. ### Prerequisites 1. You need to have Microsoft Outlo...
42,424
[ { "from": "human", "value": "How do I export all of the names and email addresses from a distribution list in Outlook using code? I have access to an Outlook 2000 or Outlook 2007 client. Ideally I would like the code to be in C#.\n" }, { "from": "gpt", "value": "To export all names and email add...
I have a very weird problem which I cannot seem to figure out. Unfortunately, I'm not even sure how to describe it without describing my entire application. What I am trying to do is: 1) read a byte from the serial port 2) store each char into tagBuffer as they are read 3) run a query using tagBuffer to see what typ...
It seems like you're experiencing an issue with how you're managing the `tagBuffer` and the variable `i`. Based on your description, the problem arises when you attempt to remove certain lines of code related to `sprintf` and `WriteFile`, which results in `tagBuffer` only holding the last character. From what you’ve ...
40,748
[ { "from": "human", "value": "I have a very weird problem which I cannot seem to figure out. Unfortunately, I'm not even sure how to describe it without describing my entire application. What I am trying to do is:\n\n1) read a byte from the serial port\n2) store each char into tagBuffer as they are read\n3...
How do I make one jquery ui slider control another? If I slide slider #1, it should slide slider #2 also.
To make one jQuery UI slider control another, you can use jQuery to listen for the `slide` event on the first slider and update the second slider's value based on the value of the first slider. Below is a simple example to demonstrate how this can be done. ### HTML ```html <!DOCTYPE html> <html lang="en"> <head> <...
41,072
[ { "from": "human", "value": "How do I make one jquery ui slider control another? If I slide slider #1, it should slide slider #2 also.\n" }, { "from": "gpt", "value": "To make one jQuery UI slider control another, you can use jQuery to listen for the `slide` event on the first slider and update ...
I have an image(a map) with some points of interest placed using position: absolute and the coordinates of each poi. I want it to expand the info of each POI on mouseover using: .poi a { width: 32px; height: 32px; overflow: hidden } .poi a:hover { width: 128px; height: 192px; overflow: auto } ...
The issue you're facing with the overflow property and mouse hover effects in Firefox and Chrome may stem from how those browsers handle `overflow` along with changes to element size during a hover state. While the approach you're using works in Internet Explorer, it can behave differently in modern browsers. To achie...
40,008
[ { "from": "human", "value": "I have an image(a map) with some points of interest placed using position: absolute and the coordinates of each poi. I want it to expand the info of each POI on mouseover using:\n.poi a {\n width: 32px;\n height: 32px;\n overflow: hidden\n}\n\n.poi a:hover {\n width:...
I want to check whether the user is viewing my site from a mobile device or PC. If it's a mobile device, I want to redirect my site URL like Google does... If possible I would like to implement this in JavaScript. How can I do this?
To determine whether a user is accessing your website from a mobile device or a PC, you can use JavaScript to check the `navigator.userAgent` property. This property contains information about the user's browser and device. Based on the result, you can redirect users to a mobile version of your site if they are using a...
44,560
[ { "from": "human", "value": "I want to check whether the user is viewing my site from a mobile device or PC. If it's a mobile device, I want to redirect my site URL like Google does...\nIf possible I would like to implement this in JavaScript. How can I do this?\n" }, { "from": "gpt", "value": "...
The company I work for writes a lot smallish Perl and Bash scripts to massage data into something usable for our software. These scripts, like any code, can change. I provided them CVS because of the file versioning rather than repository versioning. Anyway, I am thinking out a deploy tool to get the scripts from de...
Creating a deployment tool that ensures the most current version of a script from CVS is used in production requires a few considerations. Here’s a structured approach to implementing this: ### 1. Fetching the Latest Version from CVS You need to get the latest version of the script from CVS. While `cvs diff` can tell ...
40,546
[ { "from": "human", "value": "The company I work for writes a lot smallish Perl and Bash scripts to massage data into something usable for our software. These scripts, like any code, can change. I provided them CVS because of the file versioning rather than repository versioning. Anyway, I am thinking out...
just a quick question, if I have a matrix has n rows and m columns, how can I cut off the 4 sides of the matrix and return a new matrix? (the new matrix would have n-2 rows m-2 columns). Thanks in advance
To cut off the four sides of a matrix with \( n \) rows and \( m \) columns and return a new matrix with \( n-2 \) rows and \( m-2 \) columns, you can simply slice the matrix to exclude the first and last rows as well as the first and last columns. Here's how you can do it in Python using NumPy: ```python import nump...
45,471
[ { "from": "human", "value": "just a quick question, if I have a matrix has n rows and m columns, how can I cut off the 4 sides of the matrix and return a new matrix? (the new matrix would have n-2 rows m-2 columns).\nThanks in advance\n" }, { "from": "gpt", "value": "To cut off the four sides of...
I am trying to write a fragment program that will take a texture and clamp the texels between two values. That is, if the min value is say 0.2 and the max value is 0.6, any texel less than 0.2 will become 0, any texel greater than 0.6 will become 1.0, and all values in between will be mapped from 0 to 1.0. My call to g...
To address the issue you're encountering with `glProgramStringARB` resulting in a `GL_INVALID_OPERATION`, there are several points to consider regarding your shader code and how you are setting it up. Let's go through each step and see what might be causing the problem: 1. **Shader Code Issues**: - Your shader code...
40,291
[ { "from": "human", "value": "I am trying to write a fragment program that will take a texture and clamp the texels between two values. That is, if the min value is say 0.2 and the max value is 0.6, any texel less than 0.2 will become 0, any texel greater than 0.6 will become 1.0, and all values in between w...
Has anyone managed to get PDFCreator running on an ASP.NET 2.0 website ? On my development machine with Visual Studio webserver, it works just fine after following this procedure : create a com interop dll with tlbimp reference this dll write some code to use it However, when I deploy it to our test server, it fails ...
The error you're encountering, `80070005`, typically indicates a permissions issue when attempting to access a COM component from your ASP.NET application. Here are some steps to troubleshoot and potentially resolve the issue: ### 1. Check DCOM Configuration Since you mentioned that you can't find the component in `DC...
41,739
[ { "from": "human", "value": "Has anyone managed to get PDFCreator running on an ASP.NET 2.0 website ?\nOn my development machine with Visual Studio webserver, it works just fine after following this procedure :\n\ncreate a com interop dll with tlbimp\nreference this dll\nwrite some code to use it\n\nHowever...
I'm looking for a plugin for jQuery that can validate as a key is pressed and after it loses focus (text boxes). I'm currently using jVal - jQuery Form Field Validation Plugin. It works pretty good. The only issue I have is that I can only use a generic error message. For example: I need a string to between 2 and 5...
If you need a custom jQuery validation solution that can provide specific error messages based on different validation conditions, you might want to consider implementing a custom validation function using jQuery's built-in capabilities. This allows you to create more granular validation logic and display unique error ...
36,363
[ { "from": "human", "value": "I'm looking for a plugin for jQuery that can validate as a key is pressed and after it loses focus (text boxes). \nI'm currently using jVal - jQuery Form Field Validation Plugin. It works pretty good. The only issue I have is that I can only use a generic error message.\nFor ex...
I apologize in advance if this question seems remedial. Which would be considered more efficient in Python: Standard import import logging try: ...some code... exception Exception, e: logging.error(e) ...or... Contextual import try: ...some code... exception Exception, e: import logging logging.error(e)
No need to apologize; it's a good question! The difference between standard import and contextual import in Python primarily concerns readability, performance, and usage best practices. 1. **Standard Import (Module-Level Import)**: ```python import logging try: ...some code... except Exception as e...
43,080
[ { "from": "human", "value": "I apologize in advance if this question seems remedial.\nWhich would be considered more efficient in Python:\nStandard import\nimport logging\n\ntry:\n ...some code...\nexception Exception, e:\n logging.error(e)\n\n...or...\nContextual import\ntry:\n ...some code...\nexceptio...
Is there a UI library to create a message box or input box in python?
Yes, there are several libraries in Python that allow you to create message boxes or input boxes with a graphical user interface (GUI). Here are a few popular ones: 1. **Tkinter**: - Tkinter is the standard GUI toolkit for Python. It is included with most Python installations and is quite easy to use for creating s...
41,606
[ { "from": "human", "value": "Is there a UI library to create a message box or input box in python?\n" }, { "from": "gpt", "value": "Yes, there are several libraries in Python that allow you to create message boxes or input boxes with a graphical user interface (GUI). Here are a few popular ones:...
The function CreateFileMapping can be used to allocate space in the pagefile (if the first argument is INVALID_HANDLE_VALUE). The allocated space can later be memory mapped into the process virtual address space. Why would I want to do this instead of using just VirtualAlloc? It seems that both functions do almost the...
You bring up several important points regarding the differences and use cases for `CreateFileMapping` and `VirtualAlloc`. Let's break down the advantages and scenarios where you might prefer one over the other. ### Reasons to Use `CreateFileMapping` 1. **Large Dataset Handling**: - In 32-bit processes, the addres...
43,380
[ { "from": "human", "value": "The function CreateFileMapping can be used to allocate space in the pagefile (if the first argument is INVALID_HANDLE_VALUE). The allocated space can later be memory mapped into the process virtual address space.\nWhy would I want to do this instead of using just VirtualAlloc?\...
I am using .NET2.0. Let's say a have a simple aspx form with txtInput and btnSomeAction <asp:TextBox ID="txtInput" runat="server"></asp:TextBox> <asp:Button ID="btnSomeAction" runat="server" CommandName="SomeAction" Text="Do"/> Then within the code behind the form I have Protected Sub btnSomeAction_Click(ByVal s...
To use a custom namespace in your ASP.NET Web Forms application (especially with .NET 2.0), you'll need to ensure that your code-behind file properly defines the namespace and that the ASPX page is correctly linked to it. Here’s how to do it: ### 1. Modify the Code-Behind File In your code-behind file (`YourPage.asp...
42,584
[ { "from": "human", "value": "I am using .NET2.0. Let's say a have a simple aspx form with txtInput and btnSomeAction\n <asp:TextBox ID=\"txtInput\" runat=\"server\"></asp:TextBox>\n <asp:Button ID=\"btnSomeAction\" runat=\"server\" CommandName=\"SomeAction\" Text=\"Do\"/>\n\nThen within the code behind ...
I've been reading a few things about ASP.NET MVC, SOLID and so on, and I am trying to figure out a simple "recipe" for small-to-medium ASP.NET MVC apps that would put these concepts together; the issue that I am most concerned with is ending up with controllers that are too complex and being like code-behind files in w...
Your architecture idea for a small-to-medium ASP.NET MVC application has a solid foundation, and it aligns well with best practices such as separation of concerns, the SOLID principles, and testability. Here are my thoughts and suggestions to refine your approach: ### 1. **Controllers**: - Your approach of keeping con...
42,399
[ { "from": "human", "value": "I've been reading a few things about ASP.NET MVC, SOLID and so on, and I am trying to figure out a simple \"recipe\" for small-to-medium ASP.NET MVC apps that would put these concepts together; the issue that I am most concerned with is ending up with controllers that are too co...
I'm having some trouble understanding how command parameter binding works. When I create an instance of the widget class before the call to InitializeComponent it seems to work fine. Modifications to the parameter(Widget) in the ExecuteCommand function will be "applied" to _widget. This is the behavior I expected. ...
The issue you're facing with `null reference exceptions` in the `ExecuteCommand` method occurs because of how the `CommandParameter` is being set and utilized. When you set the `CommandParameter` to `TestWidget` in your XAML, it will be evaluated based on the context at the time the command is invoked. If `_widget` i...
41,550
[ { "from": "human", "value": "I'm having some trouble understanding how command parameter binding works.\nWhen I create an instance of the widget class before the call to InitializeComponent it seems to work fine. Modifications to the parameter(Widget) in the ExecuteCommand function will be \"applied\" to _...
I've seen it used a couple places: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/ http://developer.yahoo.com/flash/astra-flash/classreference/ Is this just a coincidence or is it somewhere I can grab? I'd love to use it for a new project I'm working on. Thanks!
It looks like you're looking for documentation on ActionScript 3.0 (AS3). The links you've provided point to resources that were available at the time for ActionScript 3.0 documentation, but they are now quite outdated, and the original Adobe documentation may no longer be accessible. However, there are still several ...
44,933
[ { "from": "human", "value": "I've seen it used a couple places:\n\nhttp://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/\nhttp://developer.yahoo.com/flash/astra-flash/classreference/\n\nIs this just a coincidence or is it somewhere I can grab? I'd love to use it for a new project I'm working on.\nThank...
So my Vista machine is set to turn off it's monitors after 10 minutes. (Note : machine is not suspended, or hibernated) I have a .Net application running, that needs to "wake" the system at a specified time. As a human, you just move the mouse or press a key. How do I do this programatically? I've tried : programati...
To programmatically wake up the monitor on a Windows Vista machine (or any Windows version), you can simulate mouse movement or a key press. This can be achieved using the Windows API. Below is a simple example in C# that demonstrates how to do this by simulating a mouse movement. ### Method 1: Simulating Mouse Moveme...
39,749
[ { "from": "human", "value": "So my Vista machine is set to turn off it's monitors after 10 minutes. (Note : machine is not suspended, or hibernated)\nI have a .Net application running, that needs to \"wake\" the system at a specified time. As a human, you just move the mouse or press a key. How do I do t...
Possible Duplicate: How do I get the application exit code from a Windows command line? In Unix/bash, I can simply say: $ echo $? to find out the return/exit code of a program, both from interactive and non-interactive shells. Now, how can I do the equivalent in Windows/cmd.exe?
In Windows Command Prompt (cmd.exe), you can use the `ERRORLEVEL` environment variable to find the exit code of the last executed command. After running a command, you can use the `echo` command to display it. Here's how you can do it: 1. Run your command. For example: ```cmd your_command_here ``` 2. Immedi...
45,253
[ { "from": "human", "value": "\nPossible Duplicate:\nHow do I get the application exit code from a Windows command line? \n\nIn Unix/bash, I can simply say:\n\n$ echo $?\n\nto find out the return/exit code of a program, both from interactive and non-interactive shells.\nNow, how can I do the equivalent in Wi...
I am trying to create an expression tree that represents the following: myObject.childObjectCollection.Any(i => i.Name == "name"); Shortened for clarity, I have the following: //'myObject.childObjectCollection' is represented here by 'propertyExp' //'i => i.Name == "name"' is represented here by 'predicateExp' //but I...
To create an expression tree that represents the invocation of `Any()` on a collection, we need to ensure that we're correctly specifying the method signature and types. The `Any()` method from `System.Linq` is an extension method on `IEnumerable<T>`, which means you need to call it in the context of the collection typ...
40,517
[ { "from": "human", "value": "I am trying to create an expression tree that represents the following:\nmyObject.childObjectCollection.Any(i => i.Name == \"name\");\n\nShortened for clarity, I have the following:\n//'myObject.childObjectCollection' is represented here by 'propertyExp'\n//'i => i.Name == \"nam...
I have a master page which all my views inherit from. The issue I am having is with the form tag which is created in the master page and then the form tag which is created in view. Because of the form being inside the master page form, all my postbacks are sent to the controllers Index method and its forcing me to crea...
It looks like you are facing a common issue when dealing with nested form tags in ASP.NET MVC. When you place a form tag inside a master page (layout), and then try to include another form in your views, the browser will only recognize the outermost form. As a result, all form submissions are routed to the action speci...
41,189
[ { "from": "human", "value": "I have a master page which all my views inherit from. The issue I am having is with the form tag which is created in the master page and then the form tag which is created in view.\nBecause of the form being inside the master page form, all my postbacks are sent to the controlle...
I am trying to create a dialog box that will appear only if the browser selected is IE (any version) however I get this error: Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917) That's all in "Line/Char/Code" 0 so I do not know where is the error. ...
The error you are encountering suggests an issue with the way the browser detection and dialog display are being handled in your JavaScript code. Additionally, your usage of `BrowserDetect` is problematic since it seems to refer to an external library that may not be defined correctly. Here is a modified version of y...
41,348
[ { "from": "human", "value": "I am trying to create a dialog box that will appear only if the browser selected is IE (any version) however I get this error:\n\nMessage: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)\n\nThat's all in \"Line/Char...
I'm having a problem using CSS's display:inline property with the list-style-image: property on <li> tags. Basically, I want to output the following: * Link 1 * Link 2 where * represents an image. I'm doing this with the following bit of HTML: <ol class="widgets"> <li class="l1">Link 1</li> <li class="l2">Lin...
The issue you're facing arises from the fact that the `list-style-image` property is meant to apply to block-level list items, and when you set `display: inline` on the `<li>` elements, the list-style images will not be rendered. To achieve the effect you want, you can use a different approach. Instead of using `list-...
43,156
[ { "from": "human", "value": "I'm having a problem using CSS's display:inline property with the list-style-image: property on <li> tags. Basically, I want to output the following:\n* Link 1 * Link 2\n\nwhere * represents an image.\nI'm doing this with the following bit of HTML:\n<ol class=\"widgets\">\n ...
I'm following the sample code in CFNetwork Programming Guide, specifically the section on Preventing Blocking When Working with Streams. my code is nearly identical to theirs (below) but, when I connect to my server, I get posix error 14 (bad address -- is that bad IP address (except it's not)? Bad memory address for...
The error you are encountering, POSIX error 14 (Bad address), can be quite misleading, especially for those who are new to network programming. In this case, it suggests there is an issue somewhere in your address resolution, or in how the streams are being set up or accessed. Here are several steps to debug and poten...
41,736
[ { "from": "human", "value": "I'm following the sample code in CFNetwork Programming Guide, specifically the section on Preventing Blocking When Working with Streams. my code is nearly identical to theirs (below) but, when I connect to my server, I get posix error 14 (bad address -- is that bad IP address (...
Working on big, high loaded project I got the problem that already described in billion of topics on forums and blog, but there is no solution that will help in my case. Here is the story. I have the HTML code of banner, I don't know what is the code. Sometimes it's plain HTML, but sometimes it's <script> tag with docu...
You're encountering a tricky issue that stems from the behavior of `document.write` in Internet Explorer (IE) when used in dynamic script execution. It can be particularly problematic because `document.write` can cause scripts to execute in the wrong order, especially when dealing with asynchronous loading. Here are a...
39,886
[ { "from": "human", "value": "Working on big, high loaded project I got the problem that already described in billion of topics on forums and blog, but there is no solution that will help in my case. Here is the story.\nI have the HTML code of banner, I don't know what is the code. Sometimes it's plain HTML,...
Where can I find more information about GWT and GWT-Ext's lazy loading?
To find more information about GWT (Google Web Toolkit) and GWT-Ext's lazy loading feature, you can explore the following resources: 1. **Official Documentation:** - **GWT Documentation:** The official GWT documentation provides comprehensive guides and tutorials on various features, including lazy loading. - ...
43,893
[ { "from": "human", "value": "Where can I find more information about GWT and GWT-Ext's lazy loading?\n" }, { "from": "gpt", "value": "To find more information about GWT (Google Web Toolkit) and GWT-Ext's lazy loading feature, you can explore the following resources:\n\n1. **Official Documentatio...
I am considering purchasing a code signing certificate from VeriSign or Thawte to sign an XBAP with. My question is this: What happens when that certificate expires? $299 and $599 are pretty hefty prices for 1-year/2-year cerificates, and if I have to deliver a newly signed build to my customers whenever my certificate...
When you purchase a code signing certificate from a trusted certificate authority (CA) like VeriSign or Thawte, it does indeed have an expiration date, typically one or two years. Here are some points to consider regarding what happens when the certificate expires and how you can manage this situation: ### What Happen...
42,115
[ { "from": "human", "value": "I am considering purchasing a code signing certificate from VeriSign or Thawte to sign an XBAP with. My question is this: What happens when that certificate expires? $299 and $599 are pretty hefty prices for 1-year/2-year cerificates, and if I have to deliver a newly signed buil...
How can I figure out the CRC algorithm if a given code + CRC string is given? I have got several strings consisting of code + matching CRCs but don't know how to calculate the CRC in question so that I could produce more code strings. Here are some samples (16bit code + 4bit CRC): 0010101000011101 + 0000 001010100001...
To figure out the CRC (Cyclic Redundancy Check) algorithm used in your provided examples, you can approach the problem through analysis of the given code + CRC pairs. Here are some steps you might follow to deduce the algorithm: 1. **Understanding the Structure**: It seems that you have 16-bit code strings and a 4-bit...
40,323
[ { "from": "human", "value": "How can I figure out the CRC algorithm if a given code + CRC string is given? \nI have got several strings consisting of code + matching CRCs but don't know how to calculate the CRC in question so that I could produce more code strings. Here are some samples (16bit code + 4bit C...
When writing a custom itemRenderer, how do you reference the height and width of the grid cell that it will be rendered in? In such a way that it will resize correctly when the grid is resized. I am writing a dataGrid itemRenderer that draws a bar graph in the final column of a table. I have tried referencing 'this', ...
In a custom item renderer for a DataGrid in Flex, to correctly reference the width and height of the grid cell, you generally want to make use of the `data` property for information about the item being rendered, but for the actual dimensions of the item renderer, you should utilize the `width` and `height` properties ...
39,168
[ { "from": "human", "value": "When writing a custom itemRenderer, how do you reference the height and width of the grid cell that it will be rendered in? In such a way that it will resize correctly when the grid is resized.\nI am writing a dataGrid itemRenderer that draws a bar graph in the final column of ...
Due to a weird request, I can't put null in a database if there is no value. I'm wondering what can I put in the store procedure for nothing instead of null. For example: insert into blah (blah1) values (null) Is there something like nothing or empty for "blah1" instead using null?
In SQL, if you can't use `NULL` but you want to represent the absence of a value, there are a few common alternatives you can consider based on the data type of the column and the requirements of your application: 1. **Empty String (`''`)**: If `blah1` is a string type (like `VARCHAR` or `CHAR`), you can insert an emp...
40,040
[ { "from": "human", "value": "Due to a weird request, I can't put null in a database if there is no value. I'm wondering what can I put in the store procedure for nothing instead of null.\nFor example: \ninsert into blah (blah1) values (null) \n\nIs there something like nothing or empty for \"blah1\" instead...
Is it possible to create a MySQL select statement that uses an expression as x then checks if the value for x is under a certain amount? SELECT (mytable.field1 + 10) AS x FROM `mytable` WHERE x < 50;
In MySQL, you cannot directly reference an alias in the `WHERE` clause because the `WHERE` clause is evaluated before the `SELECT` clause. However, you can achieve your goal using either a `HAVING` clause or by repeating the expression in the `WHERE` clause. Here are both methods: ### Method 1: Using `HAVING` You can ...
45,769
[ { "from": "human", "value": "Is it possible to create a MySQL select statement that uses an expression as x then checks if the value for x is under a certain amount?\nSELECT (mytable.field1 + 10) AS x FROM `mytable` WHERE x < 50;\n\n" }, { "from": "gpt", "value": "In MySQL, you cannot directly r...
I have A $param that I am passing into a template. I wish to use the value of this parameter as class name for a div. The class is not taking the value of the parameter but taking the parameter name (in the html page it is $param). Is there any way I can use the value of a parameter as a class name?
It seems like you're trying to use a templating engine where you want to render the value of a parameter as a class name for a `div` element. The specific syntax can depend on the templating engine you're using (like Handlebars, EJS, Pug, etc.), but I'll provide a general idea of how to do this in common templating lan...
43,304
[ { "from": "human", "value": "I have A $param that I am passing into a template. I wish to use the value of this parameter as class name for a div. The class is not taking the value of the parameter but taking the parameter name (in the html page it is $param). Is there any way I can use the value of a param...
Here's the deal. I have a big class hierarchy and I have this one method that is extended all the way through. The method always has to look at one or two more variable at each new level and these variable depend on the actual class in the hierarchy. What I want to do is check those two extra variables then call the su...
In C++, to achieve the behavior you're describing, you can use a combination of a pure virtual function (to force derived classes to implement their own version) and a regular virtual function (to allow base classes to provide default behavior). Here's a step-by-step breakdown of how you can implement this: 1. **Def...
42,257
[ { "from": "human", "value": "Here's the deal. I have a big class hierarchy and I have this one method that is extended all the way through. The method always has to look at one or two more variable at each new level and these variable depend on the actual class in the hierarchy. What I want to do is check t...
How do I select the unique elements from the list {0, 1, 2, 2, 2, 3, 4, 4, 5} so that I get {0, 1, 3, 5}, effectively removing all instances of the repeated elements {2, 4}?
To select the unique elements from the list `{0, 1, 2, 2, 2, 3, 4, 4, 5}` and remove all instances of the repeated elements (in this case, `2` and `4`), you can follow these steps: 1. Count the occurrences of each element in the list. 2. Identify the elements that appear more than once. 3. Create a new list that inclu...
44,520
[ { "from": "human", "value": "How do I select the unique elements from the list {0, 1, 2, 2, 2, 3, 4, 4, 5} so that I get {0, 1, 3, 5}, effectively removing all instances of the repeated elements {2, 4}?\n" }, { "from": "gpt", "value": "To select the unique elements from the list `{0, 1, 2, 2, 2,...
When I compile my application under Delphi 2006 I get the following warning [Pascal Warning]- W1002 Symbol 'FileSetDate' is specific to a platform What must I do to suppress this warning? The code MyLastError:= FileSetDate( Files[ i ].Handle, DateTimeToFileDate( arcDate ) );
The warning you're encountering (`W1002: Symbol 'FileSetDate' is specific to a platform`) occurs because the `FileSetDate` function is not available on all platforms that Delphi supports. To suppress this warning, you can use compiler directives to conditionally compile the code only for the appropriate platform. Here...
44,423
[ { "from": "human", "value": "When I compile my application under Delphi 2006 I get the following warning \n[Pascal Warning]- W1002 Symbol 'FileSetDate' is specific to a platform\nWhat must I do to suppress this warning?\nThe code \nMyLastError:= FileSetDate( Files[ i ].Handle, DateTimeToFileDate( arcDate ) ...
How do I declare a private function in Fortran?
In Fortran, you can declare a private function within a module by using the `private` attribute. The `private` attribute restricts the visibility of the function to within the module itself, meaning it cannot be accessed from outside the module unless explicitly made public. Here is an example of how to declare a priv...
42,141
[ { "from": "human", "value": "How do I declare a private function in Fortran?\n" }, { "from": "gpt", "value": "In Fortran, you can declare a private function within a module by using the `private` attribute. The `private` attribute restricts the visibility of the function to within the module its...
I have a classes like: [Serializable] public class child { public Parent parent; } [Serializable] public class Parent { public List<child> children; } When I deserialize Parent, I want each of each children to have a reference to it's parent. Question is, where in the deserialization process can I set the chi...
To achieve the desired behavior of setting the `parent` reference in each `child` object after deserializing a `Parent` object, you can use a couple of approaches. Here are two common solutions: ### 1. Manual Fix-Up After Deserialization After you deserialize the `Parent`, you can manually iterate over its children a...
42,349
[ { "from": "human", "value": "I have a classes like:\n[Serializable]\npublic class child {\n public Parent parent;\n}\n\n[Serializable]\npublic class Parent {\n public List<child> children;\n}\n\nWhen I deserialize Parent, I want each of each children to have a reference to it's parent. Question is, wh...
Consider an SQL Server table containing: ID ParentID Text === ========= ============= 1 (null) Product 2 (null) Applications 3 1 Background 4 1 Details 5 2 Mobile i fill a SqlDataSet with the table, and now i want to add the Parent-Child relation to the DataSet:...
Let's break down your question step by step to clarify the concepts of parent-child relationships in a hierarchical data structure, and explain why you're encountering issues with the `DataRelation`. ### Understanding Parent and Child in Hierarchical Data In a parent-child relationship: - **Parent**: This typically ...
39,510
[ { "from": "human", "value": "Consider an SQL Server table containing:\nID ParentID Text\n=== ========= =============\n1 (null) Product\n2 (null) Applications\n3 1 Background\n4 1 Details \n5 2 Mobile\n\ni fill a SqlDataSet with the table, and now i wan...
I currently learning about scrum and want to learn from experienced professionals in the subject. Is velocity relevant for project that take 3 month (and usually have 2-3 intermediate deliveries to customer) ? I think it's not enough time to make a statistic relevant. Is it worth to record velocity per developer acros...
Your observations and questions about Scrum are quite insightful, and they reflect a nuanced understanding of how Agile methodologies can be applied to different contexts. Let’s break down your points and questions: ### 1. **Relevance of Velocity for Short Projects** Velocity, which measures the amount of work a team ...
41,912
[ { "from": "human", "value": "I currently learning about scrum and want to learn from experienced professionals in the subject. \nIs velocity relevant for project that take 3 month (and usually have 2-3 intermediate deliveries to customer) ?\nI think it's not enough time to make a statistic relevant. Is it w...
I have written a very simple C# Console Application which will open a Crystal Report, refresh it and save it as a PDF to a specified location. When running within VS2005 everything runs fine; the pdf file is generated as expected. When I copy the .exe to my root C: drive and run it from the command line I get a dialog ...
The issue you're facing with your C# Console Application and the dialog box stating "CrystalGenerator has stopped working" on Vista could be due to a couple of reasons. Here are some steps you can follow to diagnose and resolve the issue: ### 1. **Check Crystal Reports Runtime Version** Ensure that the correct version...
43,553
[ { "from": "human", "value": "I have written a very simple C# Console Application which will open a Crystal Report, refresh it and save it as a PDF to a specified location.\nWhen running within VS2005 everything runs fine; the pdf file is generated as expected. When I copy the .exe to my root C: drive and ru...
I am deploying an application, where I need to add two prerequisites. My problme is that I need someway to provide version to the prerequisites so that in the future may be I could only update the prerequisites without updating the entire application. Thank You Sunil Chaudhary
To effectively manage and version prerequisites for your application, you can consider the following strategies: ### 1. **Use a Package Manager:** - If your application is built using a language that supports package managers (like npm for Node.js, pip for Python, or Maven for Java), you can specify the versions of...
40,992
[ { "from": "human", "value": "I am deploying an application, where I need to add two prerequisites. My problme is that I need someway to provide version to the prerequisites so that in the future may be I could only update the prerequisites without updating the entire application.\nThank You\nSunil Chaudhary...
Since the speed of the top Javascript engines seems to be on par, the next criteria is footprint. What are the code and data footprints of the leading javascript engines?
When discussing the "footprint" of JavaScript engines, we're typically referring to both the memory usage (data footprint) and the size of the compiled engine (code footprint). However, specific figures can vary based on the version of the engine, the platform it's running on, and the specific configuration or optimiza...
40,875
[ { "from": "human", "value": "Since the speed of the top Javascript engines seems to be on par, the next criteria is footprint. What are the code and data footprints of the leading javascript engines?\n" }, { "from": "gpt", "value": "When discussing the \"footprint\" of JavaScript engines, we're...
From the Mozilla Developer Network: [1,4,9].map(Math.sqrt) will yield: [1,2,3] Why then does this: ['1','2','3'].map(parseInt) yield this: [1, NaN, NaN] I have tested in Firefox 3.0.1 and Chrome 0.3 and just as a disclaimer, I know this is not cross-browser functionality (no IE). I found out that the following will...
The difference in behavior between these two examples arises from how the `map` method and the `parseInt` function work together. Let's break it down: 1. **The `map` Function**: The `map` method creates a new array populated with the results of calling a provided function on every element in the calling array. The c...
31,588
[ { "from": "human", "value": "From the Mozilla Developer Network:\n[1,4,9].map(Math.sqrt)\n\nwill yield:\n[1,2,3]\n\nWhy then does this:\n['1','2','3'].map(parseInt)\n\nyield this:\n[1, NaN, NaN]\n\nI have tested in Firefox 3.0.1 and Chrome 0.3 and just as a disclaimer, I know this is not cross-browser funct...
Once again it is time to clean up my emacs setup. Before I go cleaning it up, are there any packages that you would recommend above and beyond c++-mode, cedet, ecb, speedbar etc. ? Especially stuff that's new in the last five years.
Certainly! Emacs has a vibrant ecosystem, and there are many packages that can significantly enhance your development experience, especially for C++ development. Here are some recommended packages, particularly ones that have gained popularity or been updated in the last five years: 1. **lsp-mode**: This package provi...
43,207
[ { "from": "human", "value": "Once again it is time to clean up my emacs setup. Before I go cleaning it up, are there any packages that you would recommend above and beyond c++-mode, cedet, ecb, speedbar etc. ? Especially stuff that's new in the last five years.\n" }, { "from": "gpt", "value": "C...
I'm talking about testing a package that you're building, especially one that spawns a daemon and/or fiddles with init.d. Do you log into some sort of chroot? Do you create a virtualized distribution and tear it down? How do you test your runtime dependencies and test suite without fouling up your dev machine for the n...
When testing a package that involves spawning a daemon or interacting with `init.d`, it's important to ensure that your tests don't interfere with your development environment. Here are several strategies that can help you isolate your testing environment and dependencies: 1. **Use Containers**: Containerization techn...
42,370
[ { "from": "human", "value": "I'm talking about testing a package that you're building, especially one that spawns a daemon and/or fiddles with init.d.\nDo you log into some sort of chroot? Do you create a virtualized distribution and tear it down? How do you test your runtime dependencies and test suite wit...
I have a Silverlight application that is built from a set of Silverlight class libraries. I would like to create a common Silverlight library that contains a set of resources used to define the styles used for all the Silverlight UI libraries. This would be simlar to the <Styles>'s defined in the node within App.xam...
Yes, it is possible to create a common Silverlight library containing a set of resources that define styles for your Silverlight UI libraries. You can achieve this by creating a ResourceDictionary in a Silverlight class library. Then, you can merge this ResourceDictionary into the application’s resource dictionary, all...
41,419
[ { "from": "human", "value": "I have a Silverlight application that is built from a set of Silverlight class libraries. I would like to create a common Silverlight library that contains a set of resources used to define the styles used for all the Silverlight UI libraries. This would be simlar to the <Styl...
I'm matching ASP.Net generated elements by ID name, but I have some elements which may render as text boxes or labels depending on the page context. I need to figure out whether the match is to a textbox or label in order to know whether to get the contents by val() or by html(). $("[id$=" + endOfIdToMatch + "]").each(...
The issue you're encountering is due to how you're trying to access the tag name of the jQuery object. In jQuery, `$(this)` returns a jQuery object, and `tagName` is a property of the underlying DOM element, not a property of the jQuery object itself. To access the tag name of the element that `$(this)` refers to, you...
44,342
[ { "from": "human", "value": "I'm matching ASP.Net generated elements by ID name, but I have some elements which may render as text boxes or labels depending on the page context. I need to figure out whether the match is to a textbox or label in order to know whether to get the contents by val() or by html()...
I have an XML file and an XML schema in another file and I'd like to validate that my XML file adheres to the schema. How do I do this in Python? I'd prefer something using the standard library, but I can install a third-party package if necessary.
To validate an XML file against an XML Schema (XSD) using Python, you can use the built-in `xml.etree.ElementTree` module for parsing XML and the `xmlschema` library for validation, as the standard library doesn't provide built-in support for XML Schema validation. However, if you prefer not to install a third-party pa...
43,300
[ { "from": "human", "value": "I have an XML file and an XML schema in another file and I'd like to validate that my XML file adheres to the schema. How do I do this in Python?\nI'd prefer something using the standard library, but I can install a third-party package if necessary.\n" }, { "from": "gpt...
Is it possible to consume a JSON enabled WCF Web Service from a standard Proxy Client (i.e. not JavaScript)? Basically I want to minimize the payload size between 2 web services.
Yes, it is possible to consume a JSON-enabled WCF Web Service from a standard proxy client, provided that the client supports HTTP communication and can handle JSON content. WCF (Windows Communication Foundation) can be configured to expose services using the JSON format, which can help reduce the payload size compared...
41,701
[ { "from": "human", "value": "Is it possible to consume a JSON enabled WCF Web Service from a standard Proxy Client (i.e. not JavaScript)? \nBasically I want to minimize the payload size between 2 web services. \n" }, { "from": "gpt", "value": "Yes, it is possible to consume a JSON-enabled WCF We...
As one of my hobby projects, I'm developing an image effects plugin for jQuery. It's supposed to allow you to apply a few basic effects to an image, and does this by using the canvas HTML element or Internet Explorer filters, which ever are supported. A demo page is available at: http://sandbox.odyniec.net/imgfx-new/. ...
The issue you are experiencing with the rotation effect in Internet Explorer's matrix transformation filter is likely related to the way that multiple filters are stacked. When you apply multiple filters, the order in which they are applied can significantly impact the final rendering, and some filters may have uninten...
44,251
[ { "from": "human", "value": "As one of my hobby projects, I'm developing an image effects plugin for jQuery. It's supposed to allow you to apply a few basic effects to an image, and does this by using the canvas HTML element or Internet Explorer filters, which ever are supported.\nA demo page is available a...
I'm working on a project which stores single images and text files in one place, like a time capsule. Now, most every project can be saved as one file, like DOC, PPT, and ODF. But complete web pages can't -- they're saved as a separate HTML file and data folder. I want to save a web page in a single archive, and while...
In considering how to store web pages as single archives for your time capsule project, you've outlined several existing methods, each with its pros and cons. Let's analyze your options in the context of browser support, ease of editing, and standardization. ### 1. **MHTML (MIME HTML)** **Pros:** - Based on an establ...
42,227
[ { "from": "human", "value": "I'm working on a project which stores single images and text files in one place, like a time capsule. Now, most every project can be saved as one file, like DOC, PPT, and ODF. But complete web pages can't -- they're saved as a separate HTML file and data folder. I want to save ...
What is exactly the function of Python's Global Interpreter Lock? Do other languages that are compiled to bytecode employ a similar mechanism?
The Global Interpreter Lock (GIL) in Python is a mutex that protects access to Python objects, preventing multiple threads from executing Python bytecode concurrently. The GIL ensures that only one thread executes Python bytecode at a time, even on multi-core systems. This design choice simplifies memory management and...
40,919
[ { "from": "human", "value": "What is exactly the function of Python's Global Interpreter Lock?\nDo other languages that are compiled to bytecode employ a similar mechanism?\n" }, { "from": "gpt", "value": "The Global Interpreter Lock (GIL) in Python is a mutex that protects access to Python obje...
I type ArrayList memberNames = new ArrayList() { "Jim", "John", "George" }; and Visual Studio tells me "ArrayList" cannot be found so I have to manually go to the top of the file and type using System.Collections; Is there a way to get Visual Studio to do this automatically? In FlashDevelop, for instance, you press ...
Visual Studio does not automatically add using directives for you in the same way that some other IDEs like FlashDevelop might. However, you can enable a few features in Visual Studio that can help streamline the process of managing `using` directives. Here are some approaches you can take: 1. **Organize Usings**: If ...
43,991
[ { "from": "human", "value": "I type \nArrayList memberNames = new ArrayList() { \"Jim\", \"John\", \"George\" };\n\nand Visual Studio tells me \"ArrayList\" cannot be found so I have to manually go to the top of the file and type\nusing System.Collections;\n\nIs there a way to get Visual Studio to do this a...
I wonder if there is a way to set the value of #define in run time. I assume that there is a query for Oracle specific and Sql Server specific at the code below. #define oracle // ... #if oracle // some code #else // some different code. #endif
In C and C++, the `#define` directive is used to create macros that are determined at compile-time, not run-time. This means you cannot change the value of a `#define` during the execution of a program. The preprocessor evaluates `#define` statements before the compilation process begins, so their values are fixed when...
43,460
[ { "from": "human", "value": "I wonder if there is a way to set the value of #define in run time.\nI assume that there is a query for Oracle specific and Sql Server specific at the code below.\n#define oracle\n\n// ... \n\n#if oracle\n// some code\n#else\n// some different code.\n#endif\n\n" }, { ...
I want to set the backgroun color for a GridViewColumn that is databound inside of a listview in WPF. I'm not sure how to ask this question being fairly new to WPF, otherwise I wouldn't have bothered all of you. I want to change the background color of the whole row, based on a bool flag in my databound object. In this...
To change the background color of an entire row in a `ListView` based on a property in your data object (like `IsInternalNote` in your `CaseDetail` object), you can use a `Style` for the `ListViewItem` with a `DataTrigger`. This will allow you to set different background colors based on the value of the `IsInternalNote...
42,016
[ { "from": "human", "value": "I want to set the backgroun color for a GridViewColumn that is databound inside of a listview in WPF. I'm not sure how to ask this question being fairly new to WPF, otherwise I wouldn't have bothered all of you.\nI want to change the background color of the whole row, based on a...
Here is a specific example which is not CLS-complaint according to VS.NET 2005. Public Interface IDbId Function GetNativeObject() As Object Function Equals(ByVal compObj As IDbId) As Boolean Function CompareTo(ByVal compObj As IDbId) As Integer Function ToString() As String End Interface This is an i...
The warning that you are receiving from Visual Studio regarding the interface `IDbId` not being CLS-compliant relates specifically to the return type of the `GetNativeObject` function. The return type is `Object`, which is not CLS-compliant. ### Explanation of CLS Compliance The Common Language Specification (CLS) d...
39,584
[ { "from": "human", "value": "Here is a specific example which is not CLS-complaint according to VS.NET 2005.\nPublic Interface IDbId\n\n Function GetNativeObject() As Object\n Function Equals(ByVal compObj As IDbId) As Boolean\n Function CompareTo(ByVal compObj As IDbId) As Integer\n Function To...