instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
In Toyota manufacturing lines they always know what path a part have traveled. Just so they can be sure they can fix it of something goes wrong. Is this applicable in software too? All error messages should tell me exactly what path they traveled. Some do, the error messages with stack trace. Is this a correct interpre...
Yes, your interpretation is correct. In software development, the concept of tracking the "path" that data or processes take through a system is akin to the traceability used in manufacturing. Just as Toyota ensures they can track parts to quickly resolve issues, in software, having detailed error messages and stack tr...
8,443
[ { "from": "human", "value": "In Toyota manufacturing lines they always know what path a part have traveled. Just so they can be sure they can fix it of something goes wrong. Is this applicable in software too?\nAll error messages should tell me exactly what path they traveled. Some do, the error messages wi...
I want to override the JSON MIME type ("application/json") in Rails to ("text/x-json"). I tried to register the MIME type again in mime_types.rb but that didn't work. Any suggestions? Thanks.
To override the default JSON MIME type in a Rails application, you can add a custom MIME type in your `config/initializers/mime_types.rb` file. However, if you want to change the default JSON MIME type to a different one like `text/x-json`, you can follow these steps. ### Step 1: Define the Custom MIME Type First, en...
9,069
[ { "from": "human", "value": "I want to override the JSON MIME type (\"application/json\") in Rails to (\"text/x-json\"). I tried to register the MIME type again in mime_types.rb but that didn't work. Any suggestions?\nThanks.\n" }, { "from": "gpt", "value": "To override the default JSON MIME t...
I'm writing a script for Caseware, the accounting software my Company uses, and I need to kill a process that hangs and messes up the compression of files on the server. The problem is it needs to be written in jscript and I havn't had a lot of experience with it. I've been looking around for code examples people use t...
It looks like you're trying to use JScript to run the `taskkill.exe` command in order to terminate a process. You're on the right track, but there are a few things to consider to ensure that the command executes as expected. First, make sure you're correctly spelling the process name and that you're passing the parame...
9,008
[ { "from": "human", "value": "I'm writing a script for Caseware, the accounting software my Company uses, and I need to kill a process that hangs and messes up the compression of files on the server. The problem is it needs to be written in jscript and I havn't had a lot of experience with it.\nI've been loo...
I understand the overall meaning of pointers and references(or at least I think i do), I also understand that when I use new I am dynamically allocating memory. My question is the following: If i were to use cout << &p, it would display the "virtual memory location" of p. Is there a way in which I could manipulate this...
In C++, you can manipulate pointers and addresses directly, but it's important to understand how pointer arithmetic works, and the implications of doing so. When you have a pointer to an array (like your `int *p` pointing to a dynamically allocated array of integers), you can use pointer arithmetic to access the eleme...
7,467
[ { "from": "human", "value": "I understand the overall meaning of pointers and references(or at least I think i do), I also understand that when I use new I am dynamically allocating memory.\nMy question is the following:\nIf i were to use cout << &p, it would display the \"virtual memory location\" of p.\nI...
Does anyone know an easy way to import a raw, XML RSS feed into C#? Am looking for an easy way to get the XML as a string so I can parse it with a Regex. Thanks, -Greg
Certainly! If you want to import an XML RSS feed in C#, you can make use of the `HttpClient` class to fetch the XML content and retrieve it as a string. Once you have the XML as a string, you can parse it using Regex or any XML parsing method you prefer. Here’s a simple example of how to do this: 1. **Add a NuGet pac...
6,885
[ { "from": "human", "value": "Does anyone know an easy way to import a raw, XML RSS feed into C#? Am looking for an easy way to get the XML as a string so I can parse it with a Regex.\nThanks,\n-Greg\n" }, { "from": "gpt", "value": "Certainly! If you want to import an XML RSS feed in C#, you can...
We're having sporadic, random query timeouts on our SQL Server 2005 cluster. I own a few apps that use it, so I'm helping out in the investigation. When watching the % CPU time in regular ol' Perfmon, you can certainly see it pegging out. However, SQL activity monitor only gives cumulative CPU and IO time used by a pro...
It sounds like you're dealing with a challenging situation, especially given the age of SQL Server 2005 and the limitations in performance monitoring tools. Here are several strategies you can consider to help track down expensive queries or processes that may be causing the sporadic timeouts. ### 1. Use SQL Server Pr...
5,321
[ { "from": "human", "value": "We're having sporadic, random query timeouts on our SQL Server 2005 cluster. I own a few apps that use it, so I'm helping out in the investigation. When watching the % CPU time in regular ol' Perfmon, you can certainly see it pegging out. However, SQL activity monitor only gives...
I've tried the tools listed here, some with more success than others, but none gave me valid postgres syntax I could use (tinyint errors etc.)
When working with PostgreSQL, it’s important to understand its data types and syntax, especially if you are coming from other database systems like MySQL or SQL Server, where some data types may differ. Here are some points that can help you with PostgreSQL syntax and types: ### Common Data Types in PostgreSQL 1. **...
7,659
[ { "from": "human", "value": "I've tried the tools listed here, some with more success than others, but none gave me valid postgres syntax I could use (tinyint errors etc.)\n" }, { "from": "gpt", "value": "When working with PostgreSQL, it’s important to understand its data types and syntax, espec...
This is aquamacs 1.5 on a macbook. Exact error when I try to spell-check: Error: The file "/Library/Application Support/cocoAspell/aspell6-en-6.0-0//en-common.rws" is not in the proper format. Wrong endian order. ADDED: I indeed had the wrong version of cocoAspell. But installing the right version didn't work until I...
It sounds like you've encountered an issue with cocoAspell and its configuration files. The error message you received indicated that the dictionary file was not in the correct format, likely due to version incompatibilities or a corrupted installation. The steps you took to resolve the issue are a common and effecti...
10,898
[ { "from": "human", "value": "This is aquamacs 1.5 on a macbook. Exact error when I try to spell-check:\nError: The file \"/Library/Application Support/cocoAspell/aspell6-en-6.0-0//en-common.rws\" is not in the proper format. Wrong endian order.\nADDED: I indeed had the wrong version of cocoAspell. But ins...
What are the libraries that support XPath? Is there a full implementation? How is the library used? Where is its website?
XPath is a language used to navigate through elements and attributes in an XML document. Several libraries across different programming languages support XPath. Here are some popular ones: ### 1. **Python** - **Library:** `lxml` - **Full Implementation:** Yes, `lxml` provides a full XPath implementation. ...
3,984
[ { "from": "human", "value": "What are the libraries that support XPath? Is there a full implementation? How is the library used? Where is its website?\n" }, { "from": "gpt", "value": "XPath is a language used to navigate through elements and attributes in an XML document. Several libraries acros...
Which method you all will recommend and why?
It seems like your question is missing some context. Could you please provide more details about the specific topic, methods, or situation you're referring to? That way, I can give you a more accurate and relevant recommendation.
13,052
[ { "from": "human", "value": "Which method you all will recommend and why?\n" }, { "from": "gpt", "value": "It seems like your question is missing some context. Could you please provide more details about the specific topic, methods, or situation you're referring to? That way, I can give you a mo...
I have two spreadsheets... when one gets modified in a certain way I want to have a macro run that modifies the second in an appropriate manner. I've already isolated the event I need to act on (the modification of any cell in a particular column), I just can't seem to find any concrete information on accessing and mo...
You can indeed create a macro in Excel to modify a second spreadsheet based on changes made in the first spreadsheet. To access and modify another workbook, you can use VBA (Visual Basic for Applications) to open the other workbook and make the necessary changes. ### Here’s a basic example: Assuming you have a workbo...
7,696
[ { "from": "human", "value": "I have two spreadsheets... when one gets modified in a certain way I want to have a macro run that modifies the second in an appropriate manner. I've already isolated the event I need to act on (the modification of any cell in a particular column), I just can't seem to find any...
In regards to custom events in .NET, what is the preferred design pattern for passing event arguments? Should you have a separate EventArgs derived class for each event that can be raised, or it is acceptable to have a single class for the events if they are all raised by events from the same class?
When designing custom events in .NET, you generally have two main approaches regarding event argument classes: 1. **Separate EventArgs Derived Classes for Each Event**: This approach involves creating a distinct class that derives from `EventArgs` for each event that you define in your class. This is the recommended p...
8,987
[ { "from": "human", "value": "In regards to custom events in .NET, what is the preferred design pattern for passing event arguments? Should you have a separate EventArgs derived class for each event that can be raised, or it is acceptable to have a single class for the events if they are all raised by events...
So I'm working on a Rails app to get the feeling for the whole thing. I've got a Product model that's a standard ActiveRecord model. However, I also want to get some additional product info from Amazon ECS. So my complete model gets some of its info from the database and some from the web service. My question is, shoul...
When working with a Rails application and integrating external services like Amazon ECS, it's important to keep your code organized and maintainable. Below are some pros and cons of each approach you mentioned, along with a recommendation: ### Option 1: Two Models (Product and ProductAWS) **Pros:** - **Separation of ...
8,387
[ { "from": "human", "value": "So I'm working on a Rails app to get the feeling for the whole thing. I've got a Product model that's a standard ActiveRecord model. However, I also want to get some additional product info from Amazon ECS. So my complete model gets some of its info from the database and some fr...
This is a call for suggestions and even possible solutions. I haven't been at a company that really seemed to get credential management 'right'. I've seen excel/word documents and even post-it note 'solutions'. But my main question is what is the right way to do it? I have initially thought it would revolve around KeeP...
Credential management is a critical aspect of security in any organization, and it’s great to see you seeking out better solutions. Here are some considerations and potential strategies for effective credential management: ### 1. Use Dedicated Password Management Solutions **Enterprise Password Managers:** Look into ...
5,132
[ { "from": "human", "value": "This is a call for suggestions and even possible solutions. I haven't been at a company that really seemed to get credential management 'right'.\nI've seen excel/word documents and even post-it note 'solutions'.\nBut my main question is what is the right way to do it?\nI have in...
I'd like to write a script/batch that will bunch up my daily IIS logs and zip them up by month. ex080801.log which is in the format of exyymmdd.log ex080801.log - ex080831.log gets zipped up and the log files deleted. The reason we do this is because on a heavy site a log file for one day could be 500mb to 1gb so we zi...
Sure! You can create a batch script to automate the process of zipping up your daily IIS logs by month. Below is a Windows batch script that performs this task: ```batch @echo off setlocal enabledelayedexpansion REM Set the directory where the log files are located set "logDir=C:\path\to\your\logs" REM Change to the...
6,037
[ { "from": "human", "value": "I'd like to write a script/batch that will bunch up my daily IIS logs and zip them up by month.\nex080801.log which is in the format of exyymmdd.log\nex080801.log - ex080831.log gets zipped up and the log files deleted.\nThe reason we do this is because on a heavy site a log fil...
Every time I have to estimate time for a project (or review someone else's estimate), time is allotted for testing/bug fixing that will be done between the alpha and production releases. I know very well that estimating so far into the future regarding a problem-set of unknown size is not a good recipe for a successful...
Estimating time for testing and bug fixing can indeed be a tricky part of project management, especially when the scope and nature of the bugs are largely unknown. Here are several strategies that can help improve your estimates for these segments of work: ### 1. **Historical Data and Retrospective Analysis** - **L...
6,278
[ { "from": "human", "value": "Every time I have to estimate time for a project (or review someone else's estimate), time is allotted for testing/bug fixing that will be done between the alpha and production releases. I know very well that estimating so far into the future regarding a problem-set of unknown s...
After reading Hidden Features of C# I wondered, What are some of the hidden features of Java?
Java, like many programming languages, has several features that may not be immediately obvious to developers, especially those who are new to the language. Here are some "hidden" or less commonly known features of Java: 1. **Varargs (Variable Arguments)**: Java allows methods to accept a variable number of arguments....
3,502
[ { "from": "human", "value": "After reading Hidden Features of C# I wondered, What are some of the hidden features of Java?\n" }, { "from": "gpt", "value": "Java, like many programming languages, has several features that may not be immediately obvious to developers, especially those who are new ...
I am importing data from MS Excel spreadsheets into a php/mySQL application. Several different parties are supplying the spreadsheets and they are in formats ranging from Excel 4.0 to Excel 2007. The trouble is finding a technique to read ALL versions. More info: - I am currently using php-ExcelReader. - A script...
To handle the diverse versions of Excel files, you can utilize several approaches: ### 1. Use PHP Libraries While `php-ExcelReader` handles older Excel formats, you might want to consider using more robust libraries that can support a wider range of Excel versions, including .xls (Excel 4.0, 5.0, 97-2003) and .xlsx (E...
7,119
[ { "from": "human", "value": "I am importing data from MS Excel spreadsheets into a php/mySQL application. Several different parties are supplying the spreadsheets and they are in formats ranging from Excel 4.0 to Excel 2007. \nThe trouble is finding a technique to read ALL versions.\nMore info: \n - I am cu...
I have a folder on my server to which I had a number of symbolic links pointing. I've since created a new folder and I want to change all those symbolic links to point to the new folder. I'd considered replacing the original folder with a symlink to the new folder, but it seems that if I continued with that practice it...
Yes, you can check for symbolic links that point to a particular folder using the command line. The method may vary slightly depending on your operating system, but here are instructions for Linux/Unix systems and macOS. ### For Linux/Unix/macOS: You can use the `find` command to search for symbolic links pointing t...
7,772
[ { "from": "human", "value": "I have a folder on my server to which I had a number of symbolic links pointing. I've since created a new folder and I want to change all those symbolic links to point to the new folder. I'd considered replacing the original folder with a symlink to the new folder, but it seems ...
What is the best way to do per-user database connections in Rails? I realize this is a poor Rails design practice, but we're gradually replacing an existing web application that uses one database per user. A complete redesign/rewrite is not feasible.
Using a database-per-user model in a Rails application can indeed pose some challenges, especially regarding connection management. While it's generally not recommended to follow this pattern in new applications, if you're in a situation where you need to accommodate this structure, here are some strategies to handle p...
6,495
[ { "from": "human", "value": "What is the best way to do per-user database connections in Rails? \nI realize this is a poor Rails design practice, but we're gradually replacing an existing web application that uses one database per user. A complete redesign/rewrite is not feasible.\n" }, { "from": "g...
I'm about to perform a bunch of folder moving operations in StarTeam (including some new nesting levels) and I would like to set a label so that I can roll back in case of issues. I figured out how to set a label on a folder and all its children, but I couldn't figure out how to get the version of that folder correspo...
In StarTeam, labels are indeed primarily associated with files rather than folders. However, you can still manage your folder structure effectively by following a few steps. Here’s how you can set a label for the folders and keep track of their versions: 1. **Create a Label**: Set a label on the top-level folder and ...
8,712
[ { "from": "human", "value": "I'm about to perform a bunch of folder moving operations in StarTeam (including some new nesting levels) and I would like to set a label so that I can roll back in case of issues. I figured out how to set a label on a folder and all its children, but I couldn't figure out how t...
I've found some examples using the Win32 api or simulating the ^+ button combination (ctrl-+) using SendKeys, but at least with the SendKeys method the listview grabs the cursor and sets it to an hourglass until I hit the start button on my keyboard. What is the cleanest way to do this?
If you're looking to simulate a key press or manipulate a ListView control in a Windows Forms application without causing the application to hang or display an hourglass cursor, you can use a couple of different approaches. The method you choose will depend on your specific requirements, but here are a couple of option...
7,829
[ { "from": "human", "value": "I've found some examples using the Win32 api or simulating the ^+ button combination (ctrl-+) using SendKeys, but at least with the SendKeys method the listview grabs the cursor and sets it to an hourglass until I hit the start button on my keyboard. What is the cleanest way to...
How do I call an external command within Python as if I had typed it in a shell or command prompt?
In Python, you can call external commands (as if you had typed them in a shell or command prompt) using the `subprocess` module. The `subprocess` module provides a powerful interface for spawning new processes, connecting to their input/output/error pipes, and obtaining their return codes. Here’s how to use it: ### B...
5,400
[ { "from": "human", "value": "How do I call an external command within Python as if I had typed it in a shell or command prompt?\n" }, { "from": "gpt", "value": "In Python, you can call external commands (as if you had typed them in a shell or command prompt) using the `subprocess` module. The `s...
We need to regularly synchronize many dozens of binary files (project executables and DLLs) between many developers at several different locations, so that every developer has an up to date environment to build and test at. Due to nature of the project, updates must be done often and on-demand (overnight updates are no...
Given your requirements for frequent updates and on-demand synchronization of binary files among developers, using a traditional version control system for binaries can indeed be cumbersome. Here are some alternative approaches and tools that may suit your needs better: ### 1. **Artifact Repositories** Consider using...
5,876
[ { "from": "human", "value": "We need to regularly synchronize many dozens of binary files (project executables and DLLs) between many developers at several different locations, so that every developer has an up to date environment to build and test at. Due to nature of the project, updates must be done ofte...
In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don't have name collision? For example: foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; static i...
In an executable file generated by a toolchain like GCC that adheres to the ELF (Executable and Linkable Format), static variables, both at the file scope (global static variables) and function scope (static variables inside functions), are typically allocated in specific segments based on their initialization status. ...
9,781
[ { "from": "human", "value": "In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don't have name collision?\nFor example:\n\nfoo.c: bar.c:\nstatic int foo = 1; static int foo = 10;\nvoid fooTest() { void barTest...
I'm having a little trouble figuring out exactly how const applies in a specific case. Here's the code I have: struct Widget { Widget():x(0), y(0), z(0){} int x, y, z; }; struct WidgetHolder //Just a simple struct to hold four Widgets. { WidgetHolder(Widget a, Widget b, Widget c, Widget d): A(a), B(b), C(...
The issue you are encountering in your code relates to how you are handling the `WidgetHolder` class and its member references to `Widget`. Let's break down the relevant parts of your code and clarify the behavior you are observing. ### Class Definitions 1. **Widget Struct**: Holds three integers and has a default co...
7,287
[ { "from": "human", "value": "I'm having a little trouble figuring out exactly how const applies in a specific case. Here's the code I have:\nstruct Widget\n{\n Widget():x(0), y(0), z(0){}\n\n int x, y, z;\n};\n\nstruct WidgetHolder //Just a simple struct to hold four Widgets.\n{\n WidgetHolder(Widg...
When you use Visual Studio's code analysic (FxCop), and want to suppress a message there are 3 options. Suppress a violation in code. Suppress a violation in a GlobalSupression.cs file. Disable the violation check in the project file (via Project -> Properties -> Code Analysic). The later is very hard to review when ...
In FxCop code analysis (used in Visual Studio), when you want to suppress specific code analysis warnings, you typically do this in one of the ways you've mentioned. However, the option to suppress multiple occurrences of the same warning for different scopes (like different namespaces) in a single line is not supporte...
7,671
[ { "from": "human", "value": "When you use Visual Studio's code analysic (FxCop), and want to suppress a message there are 3 options.\n\nSuppress a violation in code.\nSuppress a violation in a GlobalSupression.cs file.\nDisable the violation check in the project file (via Project -> Properties -> Code Analy...
When you use a Windows Forms TextBox, the default number of tab stops (spaces) is 8. How do you modify this?
In a Windows Forms application, the default behavior of a `TextBox` control is that pressing the Tab key moves the focus to the next control in the form rather than inserting tab spaces. However, if you want to simulate tab stops (such as inserting spaces for indentation), you can manually handle this behavior by overr...
7,938
[ { "from": "human", "value": "When you use a Windows Forms TextBox, the default number of tab stops (spaces) is 8. How do you modify this?\n" }, { "from": "gpt", "value": "In a Windows Forms application, the default behavior of a `TextBox` control is that pressing the Tab key moves the focus to t...
As part of my integration strategy, I have a few SQL scripts that run in order to update the database. The first thing all of these scripts do is check to see if they need to run, e.g.: if @version <> @expects begin declare @error varchar(100); set @error = 'Invalid version. Your version is ' + conv...
In SQL Server, the `CREATE PROCEDURE` statement indeed needs to be the first statement in a batch, which creates a challenge when you want to conditionally execute it based on some checks like versioning. To work around this limitation, you can use dynamic SQL to execute your `CREATE PROCEDURE` statement conditionally....
9,502
[ { "from": "human", "value": "As part of my integration strategy, I have a few SQL scripts that run in order to update the database. The first thing all of these scripts do is check to see if they need to run, e.g.:\nif @version <> @expects\n begin\n declare @error varchar(100);\n set @error...
Can somebody in SO please provide me with a list of resources about Enterprise Mashups and technologies related to SharePoint platform? Update (as per suggestion of @Spoon16 in the comments):- The mashup application may typically retrieve a list of contacts from a SharePoint site and display the address of a selected c...
Certainly! Here’s a list of resources and technologies related to Enterprise Mashups, specifically in the context of the SharePoint platform. This includes documentation, articles, tutorials, and tools that can help you understand how to create mashups using SharePoint. ### Resources on Enterprise Mashups and SharePoi...
8,087
[ { "from": "human", "value": "Can somebody in SO please provide me with a list of resources about Enterprise Mashups and technologies related to SharePoint platform?\nUpdate (as per suggestion of @Spoon16 in the comments):-\nThe mashup application may typically retrieve a list of contacts from a SharePoint s...
What are some good ways to do this? Is it even possible to do cleanly? Ideally I'd like to use packet headers to decide which server should handle requests. However, if there is an easier/better way let me know.
It seems like you're exploring ways to route network traffic to different servers based on certain criteria, such as packet headers. Depending on your specific requirements and network environment, there are several methods to achieve this. Here are some common approaches: ### 1. **Load Balancers** Load balancers can ...
8,933
[ { "from": "human", "value": "What are some good ways to do this? Is it even possible to do cleanly? \nIdeally I'd like to use packet headers to decide which server should handle requests. However, if there is an easier/better way let me know.\n" }, { "from": "gpt", "value": "It seems like you're...
I'm working on a web page where I'm making an AJAX call that returns a chunk of HTML like: <div> <!-- some html --> <script type="text/javascript"> /** some javascript */ </script> </div> I'm inserting the whole thing into the DOM, but the JavaScript isn't being run. Is there a way to run it? Some detail...
When you dynamically insert HTML that contains `<script>` tags into the DOM, the browser doesn't automatically execute the scripts within those tags. However, there are a couple of ways to run those scripts after injecting the HTML: ### 1. Using `innerHTML` and `document.createElement` One common workaround is to man...
7,831
[ { "from": "human", "value": "I'm working on a web page where I'm making an AJAX call that returns a chunk of HTML like: \n<div>\n <!-- some html -->\n <script type=\"text/javascript\">\n /** some javascript */\n </script>\n</div>\n\nI'm inserting the whole thing into the DOM, but the JavaScript isn't ...
Working in a medium size project during last 4 months - we are using JPA and Spring - I'm quite sure that JPA is not powerfull for projects that requires more than CRUD screen... Query interface is poor, Hibernate doesn't respect JPA spec all the time and lot of times I need to use hibernate classes, annotations a...
Your concerns about JPA (Java Persistence API) and Hibernate are quite common, especially when working on medium to large-sized projects that require more than just basic CRUD operations. Here are some points to consider regarding your experience and thoughts: 1. **Abstraction Level**: JPA is designed as a high-level ...
8,937
[ { "from": "human", "value": "Working in a medium size project during last 4 months - we \nare using JPA and Spring - I'm quite sure that JPA is not \npowerfull for projects that requires more than CRUD \nscreen... Query interface is poor, Hibernate doesn't \nrespect JPA spec all the time and lot of times I ...
How can I take the string foo[]=1&foo[]=5&foo[]=2 and return a collection with the values 1,5,2 in that order. I am looking for an answer using regex in C#. Thanks
You can use a regular expression in C# to extract the values from the query string `foo[]=1&foo[]=5&foo[]=2`. Below is a simple example of how to achieve this using the `Regex` class from the `System.Text.RegularExpressions` namespace. Here’s a complete C# code snippet that demonstrates how to extract the values and s...
9,647
[ { "from": "human", "value": "How can I take the string foo[]=1&foo[]=5&foo[]=2 and return a collection with the values 1,5,2 in that order. I am looking for an answer using regex in C#. Thanks\n" }, { "from": "gpt", "value": "You can use a regular expression in C# to extract the values from the ...
If I use the following code I lose the ability to right click on variables in the code behind and refactor (rename in this case) them <a href='<%# "/Admin/Content/EditResource.aspx?ResourceId=" + Eval("Id").ToString() %>'>Edit</a> I see this practice everywhere but it seems weird to me as I no longer am able to get co...
Your concerns are valid, and they touch on a few important aspects of ASP.NET web development, particularly when using data binding expressions versus server-side controls. ### Using Data Binding Expressions ```asp <a href='<%# "/Admin/Content/EditResource.aspx?ResourceId=" + Eval("Id").ToString() %>'>Edit</a> ``` 1. ...
9,231
[ { "from": "human", "value": "If I use the following code I lose the ability to right click on variables in the code behind and refactor (rename in this case) them\n<a href='<%# \"/Admin/Content/EditResource.aspx?ResourceId=\" + Eval(\"Id\").ToString() %>'>Edit</a>\n\nI see this practice everywhere but it se...
I have a filename in a format like: system-source-yyyymmdd.dat I'd like to be able to parse out the different bits of the filename using the "-" as a delimiter.
You can easily parse the filename by splitting it using the "-" delimiter. Below is an example of how to do this in Python: ```python # Sample filename filename = "system-source-20231015.dat" # Remove the file extension filename_without_extension = filename.split('.')[0] # Split the filename using "-" as a delimiter...
11,222
[ { "from": "human", "value": "I have a filename in a format like:\n\nsystem-source-yyyymmdd.dat\n\nI'd like to be able to parse out the different bits of the filename using the \"-\" as a delimiter.\n" }, { "from": "gpt", "value": "You can easily parse the filename by splitting it using the \"-\"...
I've recently started developing applications for the Blackberry. Consequently, I've had to jump to Java-ME and learn that and its associated tools. The syntax is easy, but I keep having issues with various gotchas and the environment. For instance, something that surprised me and wasted a lot of time is absence of...
Transitioning to Java ME, especially for BlackBerry development, can indeed present several challenges due to its unique limitations and characteristics compared to more modern environments and languages like C#. Here are some tips and resources to help you adapt to Java ME and the BlackBerry development environment: ...
6,573
[ { "from": "human", "value": "I've recently started developing applications for the Blackberry. Consequently, I've had to jump to Java-ME and learn that and its associated tools. The syntax is easy, but I keep having issues with various gotchas and the environment. \nFor instance, something that surprised...
I'm fairly new to the STL, so I was wondering whether there are any dynamically sortable containers? At the moment my current thinking is to use a vector in conjunction with the various sort algorithms, but I'm not sure whether there's a more appropriate selection given the (presumably) linear complexity of inserting ...
In C++, the Standard Template Library (STL) provides several containers, but the most commonly used dynamically sortable container is indeed `std::vector`, as you mentioned. It offers the flexibility to easily modify, insert, or remove elements, and you can sort it using `std::sort` as needed. However, if you are look...
5,301
[ { "from": "human", "value": "I'm fairly new to the STL, so I was wondering whether there are any dynamically sortable containers? At the moment my current thinking is to use a vector in conjunction with the various sort algorithms, but I'm not sure whether there's a more appropriate selection given the (pr...
I've setup a new .net 2.0 website on IIS 7 under Win Server 2k8 and when browsing to a page it gives me a 404.17 error, claiming that the file (default.aspx in this case) appears to be a script but is being handled by the static file handler. It SOUNDS like the module mappings for ASP.Net got messed up, but they look ...
The 404.17 error you are encountering indicates that the request for the `default.aspx` page is being treated as a static file, rather than being processed by the ASP.NET handler. This can happen for various reasons, but you can troubleshoot and resolve this issue using the following steps: ### 1. Ensure ASP.NET is In...
6,737
[ { "from": "human", "value": "I've setup a new .net 2.0 website on IIS 7 under Win Server 2k8 and when browsing to a page it gives me a 404.17 error, claiming that the file (default.aspx in this case) appears to be a script but is being handled by the static file handler. It SOUNDS like the module mappings ...
How do I get timestamp from e.g. 22-09-2008?
To convert a date like "22-09-2008" to a timestamp in various programming languages, you typically need to parse the string into a date object and then convert it to a timestamp (which is usually the number of seconds or milliseconds since the epoch, January 1, 1970). Here are some examples in different programming la...
8,105
[ { "from": "human", "value": "How do I get timestamp from e.g. 22-09-2008?\n" }, { "from": "gpt", "value": "To convert a date like \"22-09-2008\" to a timestamp in various programming languages, you typically need to parse the string into a date object and then convert it to a timestamp (which is...
I have a Yahoo map with lots of markers (~500). The map performs well enough until I close the page, at which point it pauses (in Firefox) and brings up a "Stop running this script?" dialog (in IE7). If given long enough the script does complete its work. Is there anything I can do to reduce this delay? This stripped d...
When dealing with a large number of markers on a map, performance issues, especially when closing the page, can arise due to the cleanup process the browser undertakes. Here are several strategies to help reduce the delay you are experiencing: 1. **Batch Processing**: Instead of adding markers one at a time in a for l...
7,665
[ { "from": "human", "value": "I have a Yahoo map with lots of markers (~500). The map performs well enough until I close the page, at which point it pauses (in Firefox) and brings up a \"Stop running this script?\" dialog (in IE7). If given long enough the script does complete its work.\nIs there anything I ...
I need to extract and decode barcodes and text from images. Is there any open source library available that helps to accomplish that task? If not, do you know a good commercial product?
Yes, there are several open-source libraries available that can help you extract and decode barcodes and text from images. Here are a few popular ones: 1. **Zxing (Zebra Crossing)**: This is a well-known open-source library for barcode image processing. It supports various barcode formats including QR codes, Data Matr...
9,208
[ { "from": "human", "value": "I need to extract and decode barcodes and text from images. Is there any open source library available that helps to accomplish that task? If not, do you know a good commercial product?\n" }, { "from": "gpt", "value": "Yes, there are several open-source libraries ava...
I have a page which spawns a popup browser window. I have a JavaScript variable in the parent browser window and I would like to pass it to the popped-up browser window. Is there a way to do this? I know this can be done across frames in the same browser window but I'm not sure if it can be done across browser windows....
Yes, you can pass data from a parent browser window to a popup window in JavaScript. When you open a new popup window using `window.open()`, the new window will have access to the parent window's properties and variables through the `window.opener` object. Here's a simple example to demonstrate how to do this: ### Pa...
7,919
[ { "from": "human", "value": "I have a page which spawns a popup browser window. I have a JavaScript variable in the parent browser window and I would like to pass it to the popped-up browser window.\nIs there a way to do this? I know this can be done across frames in the same browser window but I'm not sure...
Almost 5 years ago Joel Spolsky wrote this article, "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)". Like many, I read it carefully, realizing it was high-time I got to grips with this "replacement for ASCII". Unfortunately, 5 years later ...
It's great that you're taking the initiative to improve your understanding of Unicode and character sets. Here are some insights and recommendations to help you move forward: ### Getting Over ASCII Once and For All 1. **Understand the Limitations of ASCII**: - Recognize that ASCII only supports 128 characters (0-1...
7,072
[ { "from": "human", "value": "Almost 5 years ago Joel Spolsky wrote this article, \"The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)\".\nLike many, I read it carefully, realizing it was high-time I got to grips with this \"replaceme...
I'm designing my website and was curious, before I go rip someone else's ideas, what were the salient considerations and questions one should ask in designing a database?
Designing a database is a critical step in web development, and there are several salient considerations and questions you should ask to ensure that your database is efficient, scalable, and meets your application’s needs. Here are some key points to consider: ### 1. **Understand Your Requirements** - What are the ...
7,882
[ { "from": "human", "value": "I'm designing my website and was curious, before I go rip someone else's ideas, what were the salient considerations and questions one should ask in designing a database?\n" }, { "from": "gpt", "value": "Designing a database is a critical step in web development, an...
I have some Ruby code which takes dates on the command line in the format: -d 20080101,20080201..20080229,20080301 I want to run for all dates between 20080201 and 20080229 inclusive and the other dates present in the list. I can get the string 20080201..20080229, so is the best way to convert this to a Range instance...
Using `eval` to convert a string into a Ruby object is generally discouraged due to security risks, as it will execute arbitrary code. Instead, you can achieve the conversion from a string representation of a range (like `"20080201..20080229"`) to a `Range` instance using safer methods. Here’s a general approach to co...
6,783
[ { "from": "human", "value": "I have some Ruby code which takes dates on the command line in the format:\n-d 20080101,20080201..20080229,20080301\n\nI want to run for all dates between 20080201 and 20080229 inclusive and the other dates present in the list.\nI can get the string 20080201..20080229, so is the...
Do you write one test per function/method, with multiple checks in the test, or a test for each check?
The decision of whether to write one test per function/method with multiple checks or to write a test for each check often depends on the context, complexity of the function, and testing philosophy. Here are some considerations for each approach: ### One Test per Function/Method with Multiple Checks **Pros:** - **Conc...
8,544
[ { "from": "human", "value": "Do you write one test per function/method, with multiple checks in the test, or a test for each check?\n" }, { "from": "gpt", "value": "The decision of whether to write one test per function/method with multiple checks or to write a test for each check often depends ...
I have finally started messing around with creating some apps that work with RESTful web interfaces, however, I am concerned that I am hammering their servers every time I hit F5 to run a series of tests.. Basically, I need to get a series of web responses so I can test I am parsing the varying responses correctly, rat...
It's great that you're exploring ways to efficiently test your application without putting unnecessary load on external servers! Mocking web responses is a common practice in software development, especially when working with APIs. Your approach of using an interface to abstract away the details of fetching responses i...
7,532
[ { "from": "human", "value": "I have finally started messing around with creating some apps that work with RESTful web interfaces, however, I am concerned that I am hammering their servers every time I hit F5 to run a series of tests..\nBasically, I need to get a series of web responses so I can test I am pa...
I need to put an alpha blended gradient border around an image. My problem is in blending the corners so they are smooth where the horizontal and vertical gradients meet. I believe there is a standard algorithm that solves this problem. I think I even encountered it in school many years ago. But I have been unsucces...
To create a smooth alpha blended gradient border around an image that transitions smoothly in the corners, you can use a technique based on calculating the distance from the corners of the image. Below is a detailed explanation of a method that you can implement: ### 1. Gradient Calculation Overview The goal is to cr...
6,894
[ { "from": "human", "value": "I need to put an alpha blended gradient border around an image. My problem is in blending the corners so they are smooth where the horizontal and vertical gradients meet. I believe there is a standard algorithm that solves this problem. I think I even encountered it in school ...
Is there a performant equivalent to the isnull function for DB2? Imagine some of our products are internal, so they don't have names: Select product.id, isnull(product.name, "Internal) From product Might return: 1 Socks 2 Shoes 3 Internal 4 Pants
In DB2, you can use the `COALESCE` function as an alternative to the `ISNULL` function. The `COALESCE` function returns the first non-null value from a list of arguments. It is often used for similar purposes as `ISNULL`. In your case, you can rewrite your SQL query using `COALESCE` like this: ```sql SELECT product.i...
12,076
[ { "from": "human", "value": "Is there a performant equivalent to the isnull function for DB2?\nImagine some of our products are internal, so they don't have names:\nSelect product.id, isnull(product.name, \"Internal) \nFrom product\n\nMight return:\n1 Socks \n2 Shoes \n3 Internal \n4 Pants\n\n" }, { ...
Is there a way to hide the google toolbar in my browser programmable?
Hiding the Google toolbar (or any toolbar) in a web browser programmatically can depend on the browser and the specific context in which you're trying to hide it. Here are a few general approaches based on different scenarios: ### 1. **Browser Extensions/Add-ons:** If you're developing a browser extension, you may hav...
8,053
[ { "from": "human", "value": "Is there a way to hide the google toolbar in my browser programmable?\n" }, { "from": "gpt", "value": "Hiding the Google toolbar (or any toolbar) in a web browser programmatically can depend on the browser and the specific context in which you're trying to hide it. H...
I'm trying to upgrade a package using yum on Fedora 8. The package is elfutils. Here's what I have installed locally: $ yum info elfutils Installed Packages Name : elfutils Arch : x86_64 Version: 0.130 Release: 3.fc8 Size : 436 k Repo : installed Summary: A collection of utilities and DSOs to handle compiled ob...
It looks like you're running into an issue where the `yum` tool is unable to find the update for the `elfutils` package, even though you've confirmed that a newer version is available in the Fedora 8 updates repository. Here are a few troubleshooting steps you can take to resolve this: 1. **Clear the yum cache**: Som...
9,248
[ { "from": "human", "value": "I'm trying to upgrade a package using yum on Fedora 8. The package is elfutils. Here's what I have installed locally:\n$ yum info elfutils\nInstalled Packages\nName : elfutils\nArch : x86_64\nVersion: 0.130\nRelease: 3.fc8\nSize : 436 k\nRepo : installed\nSummary: A coll...
What is the best way to keep an asp:button from displaying it's URL on the status bar of the browser? The button is currently defines like this: <asp:button id="btnFind" runat="server" Text="Find Info" onclick="btnFind_Click"> </asp:button> Update: This appears to be specific to...
In Internet Explorer (IE), the URL of a link can sometimes be displayed in the status bar when a button is used. However, you can take a few approaches to prevent this behavior, especially if it is specific to certain versions like IE6 and IE7. Here are some options: ### Option 1: Use JavaScript to Prevent Default Beh...
7,240
[ { "from": "human", "value": "What is the best way to keep an asp:button from displaying it's URL on the status bar of the browser? The button is currently defines like this:\n<asp:button id=\"btnFind\" \n runat=\"server\" \n Text=\"Find Info\" \n onclick=\"btnFind_Click\">\...
In SharePoint, it is easy to set up a List webpart consisting of Links to other documents, folders, sites, etc. Unfortunately, when clicking these links, the default behavior is for the page to open in the current browser window. That is, it does NOT open the page in a new instance of the browser. This has proven an...
In SharePoint, the default behavior of links in a List web part is to open in the same window or tab. Unfortunately, SharePoint does not provide a built-in option to force links to open in a new browser window or tab directly within the List web part settings. However, you can implement a couple of workarounds to achie...
8,050
[ { "from": "human", "value": "In SharePoint, it is easy to set up a List webpart consisting of Links to other documents, folders, sites, etc. Unfortunately, when clicking these links, the default behavior is for the page to open in the current browser window. That is, it does NOT open the page in a new ins...
I'm using a winforms webbrowser control to display some content in a windows forms app. I'm using the DocumentText property to write the generated HTML. That part is working spectacularly. Now I want to use some images in the markup. (I also would prefer to use linked CSS and JavaScript, however, that can be worked...
When using the `WebBrowser` control in a WinForms application, it does indeed treat the content you write to it using the `DocumentText` property as coming from a blank document, hence the `about:blank` base URL. This can complicate referencing local resources like images, CSS, and JavaScript. Given your constraints a...
6,074
[ { "from": "human", "value": "I'm using a winforms webbrowser control to display some content in a windows forms app. I'm using the DocumentText property to write the generated HTML. That part is working spectacularly. Now I want to use some images in the markup. (I also would prefer to use linked CSS an...
I've got a web application that I'm trying to optimize. Some of the controls are hidden in dialog-style DIVs. So, I'd like to have them load in via AJAX only when the user wants to see them. This is fine for controls that are mostly literal-based (various menus and widgets), but when I have what I call "dirty" control...
Optimizing your ASP.NET web application to load controls via AJAX can indeed be a challenge, particularly when dealing with controls that heavily rely on ViewState, scripts, and CSS. However, you can approach this problem systematically to achieve a more efficient solution without significant server overhead. ### Here...
1,384
[ { "from": "human", "value": "I've got a web application that I'm trying to optimize. Some of the controls are hidden in dialog-style DIVs. So, I'd like to have them load in via AJAX only when the user wants to see them. This is fine for controls that are mostly literal-based (various menus and widgets), bu...
Has anyone used Lucene.NET rather than using the full text search that comes with sql server? If so I would be interested on how you implemented it. Did you for example write a windows service that queried the database every hour then saved the results to the lucene.net index?
Yes, many developers opt for using Lucene.NET for full-text search capabilities instead of the built-in full-text search in SQL Server. Lucene.NET offers powerful indexing and searching capabilities that can be more flexible and performant for certain applications. Here’s a general overview of how one might implement L...
4,848
[ { "from": "human", "value": "Has anyone used Lucene.NET rather than using the full text search that comes with sql server?\nIf so I would be interested on how you implemented it. \nDid you for example write a windows service that queried the database every hour then saved the results to the lucene.net inde...
I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in other ways to monitor a variable in C/C++ to see if/when it changes.
Yes, you can set breakpoints in GDB to monitor when a specific variable is accessed or modified. Here are some ways to achieve this: ### Method 1: Breakpoint on Access To set a breakpoint on a specific variable access, you can use the following command in GDB: 1. **Access Breakpoint**: To break on read access of a v...
6,631
[ { "from": "human", "value": "I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in other ways to monitor a variable in C/C++ to see if/when it changes.\n" }, { ...
I wonder what the best practice for this scenario is: I have a Sharepoint Site (MOSS2007) with an ASPX Page on it. However, I cannot use any inline source and stuff like Event handlers do not work, because Sharepoint does not allow Server Side Script on ASPX Pages per default. Two solutions: Change the PageParserPath ...
In SharePoint 2007 (MOSS 2007), there are indeed restrictions on using server-side scripts in ASPX pages due to security and stability concerns. Let's consider your options: ### 1. Change the PageParserPath in web.config **Pros:** - Allows you to use inline server-side scripts directly in your ASPX page. - Gives you m...
7,116
[ { "from": "human", "value": "I wonder what the best practice for this scenario is:\nI have a Sharepoint Site (MOSS2007) with an ASPX Page on it. However, I cannot use any inline source and stuff like Event handlers do not work, because Sharepoint does not allow Server Side Script on ASPX Pages per default.\...
I have an Ajax.Net enabled ASP.Net 2.0 web site. Hosting for both the site and the database are out of my control as is the database's schema. In testing on hardware I do control the site performs well however on the client's hardware, there are noticeable delays when reloading or changing pages. What I would like to ...
To optimize your Ajax.Net enabled ASP.Net 2.0 website and reduce load times, there are several strategies you can implement, especially focusing on static resources like JavaScript and CSS files. Here’s a breakdown of your options: ### 1. Set Expiration Headers for Static Resources Setting expiration dates for static ...
2,019
[ { "from": "human", "value": "I have an Ajax.Net enabled ASP.Net 2.0 web site. Hosting for both the site and the database are out of my control as is the database's schema. In testing on hardware I do control the site performs well however on the client's hardware, there are noticeable delays when reloading ...
I want to parse a config file sorta thing, like so: [KEY:Value] [SUBKEY:SubValue] Now I started with a StreamReader, converting lines into character arrays, when I figured there's gotta be a better way. So I ask you, humble reader, to help me. One restriction is that it has to work in a Linux/Mono environment...
Parsing a config file like the one you described can be effectively done using simple string manipulation methods available in C#. Below is a basic example that reads a configuration file formatted with `[KEY:Value]` and `[SUBKEY:SubValue]`, then extracts and stores this information in a way that you can easily access ...
1,657
[ { "from": "human", "value": "I want to parse a config file sorta thing, like so:\n[KEY:Value] \n [SUBKEY:SubValue]\n\nNow I started with a StreamReader, converting lines into character arrays, when I figured there's gotta be a better way. So I ask you, humble reader, to help me.\nOne restriction is t...
Have been trying out the new Dynamic Data site create tool that shipped with .NET 3.5. The tool uses LINQ Datasources to get the data from the database using a .dmbl context file for a reference. I am interseted in customizing a data grid but I need to show data from more than one table. Does anyone know how to do th...
To show data from more than one table in a data grid using the LINQ DataSource object in a .NET application, you'll typically want to use a join operation in LINQ to combine data from the different tables. Here’s a general approach to achieving this: ### Steps to Customize a Data Grid with Data from Multiple Tables 1...
5,943
[ { "from": "human", "value": "Have been trying out the new Dynamic Data site create tool that shipped with .NET 3.5. The tool uses LINQ Datasources to get the data from the database using a .dmbl context file for a reference. I am interseted in customizing a data grid but I need to show data from more than ...
I am trying to build a dependency graph of tables based on the foreign keys between them. This graph needs to start with an arbitrary table name as its root. I could, given a table name look up the tables that reference it using the all_constraints view, then look up the tables that reference them, and so on, but thi...
When you're trying to build a dependency graph of tables based on foreign keys in an Oracle database, it can be done using recursive queries, often referred to as "connect by" queries. However, if you're encountering issues where your recursive query doesn't return the entire tree when adding the `START WITH` clause, i...
6,565
[ { "from": "human", "value": "I am trying to build a dependency graph of tables based on the foreign keys between them. This graph needs to start with an arbitrary table name as its root. I could, given a table name look up the tables that reference it using the all_constraints view, then look up the table...
I have an List and I'd like to wrap it into an IQueryable. Is this possible?
Yes, you can wrap a `List<T>` into an `IQueryable<T>` in C#. This is useful when you want to use LINQ queries that expect an `IQueryable` for deferred execution or when you want to take advantage of LINQ providers. To achieve this, you can use the `AsQueryable()` method provided by LINQ, which allows you to convert an...
9,499
[ { "from": "human", "value": "I have an List and I'd like to wrap it into an IQueryable.\nIs this possible?\n" }, { "from": "gpt", "value": "Yes, you can wrap a `List<T>` into an `IQueryable<T>` in C#. This is useful when you want to use LINQ queries that expect an `IQueryable` for deferred execu...
We have hundreds of websites which were developed in asp, .net and java and we are paying lot of money for an external agency to do a penetration testing for our sites to check for security loopholes. Are there any (good) software (paid or free) to do this? or.. are there any technical articles which can help me deve...
Conducting penetration testing for web applications is essential for identifying vulnerabilities and improving security. While hiring external agencies is a common practice, there are several tools available that can assist you in performing penetration testing in-house, both free and paid. Below are some recommendatio...
6,176
[ { "from": "human", "value": "We have hundreds of websites which were developed in asp, .net and java and we are paying lot of money for an external agency to do a penetration testing for our sites to check for security loopholes. \nAre there any (good) software (paid or free) to do this? \nor.. are there an...
I see here that there are a load of languages aside from Java that run on the JVM. I'm a bit confused about the whole concept of other languages running in the JVM. So: What is the advantage in having other languages for the JVM? What is required (in high level terms) to write a language/compiler for the JVM? How do y...
Great questions! Let's break this down step by step. ### Advantages of Other Languages on the JVM 1. **Performance and Optimization**: The JVM provides excellent performance and optimization features, such as Just-In-Time (JIT) compilation and garbage collection. Languages that run on the JVM can leverage these optim...
4,635
[ { "from": "human", "value": "I see here that there are a load of languages aside from Java that run on the JVM. I'm a bit confused about the whole concept of other languages running in the JVM. So:\nWhat is the advantage in having other languages for the JVM?\nWhat is required (in high level terms) to write...
I have a string that is like below. ,liger, unicorn, snipe in other languages I'm familiar with I can just do a string.trim(",") but how can I do that in c#? Thanks. There's been a lot of back and forth about the StartTrim function. As several have pointed out, the StartTrim doesn't affect the primary variable. How...
In C#, you can remove specific characters from the start of a string using a combination of the `TrimStart` method along with the `ToCharArray` method. While there isn't a direct `String.Trim` method that allows you to specify a character to trim only from the start, you can achieve this easily. Here's an example of h...
9,995
[ { "from": "human", "value": "I have a string that is like below.\n,liger, unicorn, snipe\n\nin other languages I'm familiar with I can just do a string.trim(\",\") but how can I do that in c#?\nThanks.\n\nThere's been a lot of back and forth about the StartTrim function. As several have pointed out, the St...
I'm trying to have the same KDE Konsole experience within Mac OS X. Here's my (overly complicated?) setup: I have Control and Command swapped at the System Preferences level. (Can't live without this) Parallels lets you, at the Parallels application level, also reverse Control and Command. So I can undo the System P...
To achieve a similar setup in the Mac OS X Terminal app, where you have per-application settings for Control and Command keys without affecting the overall system preferences, you have a few options, though it might not be as straightforward as in Parallels: ### Option 1: Use Terminal Profiles 1. **Create a New Termi...
7,160
[ { "from": "human", "value": "I'm trying to have the same KDE Konsole experience within Mac OS X.\nHere's my (overly complicated?) setup:\n\nI have Control and Command swapped at the System Preferences level. (Can't live without this)\nParallels lets you, at the Parallels application level, also reverse Con...
I am working at a client site where there is a proxy server (HTTP) in place. If I do a hard reset of the emulator it forgets network connection settings for the emulator and settings in the hosted Windows Mobile OS. If I 'save state and exit' it will lose all of these settings. I need to do hard resets regularly which ...
To simplify the process of configuring your Windows Mobile emulator settings after a hard reset, you have a few options. You cannot directly set persistent defaults in the emulator itself, but you can use scripts and/or create a simple installer to automate the process of applying your settings. Here are some strategie...
5,641
[ { "from": "human", "value": "I am working at a client site where there is a proxy server (HTTP) in place. If I do a hard reset of the emulator it forgets network connection settings for the emulator and settings in the hosted Windows Mobile OS. If I 'save state and exit' it will lose all of these settings. ...
I am unable to consume messages sent via ActiveMQ from my Flex client. Sending messages via the Producer seems to work, I can also see that the Flex client is connected and subscribed via the properties on the Consumer object, however the "message" event on the Consumer is never fired so it seems like the messages are ...
It sounds like you're experiencing issues with message consumption in your Flex client from ActiveMQ, despite the producer successfully sending messages. Here are several troubleshooting steps and potential solutions to help you resolve this issue: 1. **Check the Message Destination**: Make sure that the topic or queu...
7,406
[ { "from": "human", "value": "I am unable to consume messages sent via ActiveMQ from my Flex client. Sending messages via the Producer seems to work, I can also see that the Flex client is connected and subscribed via the properties on the Consumer object, however the \"message\" event on the Consumer is nev...
Can anyone suggest a way of getting version information into a Web Service? (VB.NET) I would like to dynamically use the assembly version in the title or description, but the attributes require constants. Is manually writing the version info as a string the only way of displaying the information on the .asmx page?
In VB.NET, while the assembly attributes such as `AssemblyTitle` and `AssemblyDescription` require constant values at compile time, you can still retrieve the version information at runtime using reflection. This allows you to dynamically display the version information in your web service. Here's how you can do it: ...
7,259
[ { "from": "human", "value": "Can anyone suggest a way of getting version information into a Web Service? (VB.NET)\nI would like to dynamically use the assembly version in the title or description, but the attributes require constants. \nIs manually writing the version info as a string the only way of displa...
Is there a detailed guide which explains how to host a website on your own server on linux. I have currently hosted it on one of the commerical web-hosts. Also the domain is registered to a different vendor. Thanks
Certainly! Hosting a website on your own Linux server involves several steps, from setting up the server itself to configuring the web server and linking your domain. Below is a detailed guide to help you through the process. ### Step 1: Set Up Your Linux Server 1. **Choose a Linux Distribution**: Popular choices inc...
2,717
[ { "from": "human", "value": "Is there a detailed guide which explains how to host a website on your own server on linux.\nI have currently hosted it on one of the commerical web-hosts.\nAlso the domain is registered to a different vendor.\nThanks\n" }, { "from": "gpt", "value": "Certainly! Hosti...
Has anyone written an 'UnFormat' routine for Delphi? What I'm imagining is the inverse of SysUtils.Format and looks something like this UnFormat('a number %n and another %n',[float1, float2]); So you could unpack a string into a series of variables using format strings. I've looked at the 'Format' routine in SysUti...
There isn't a built-in `UnFormat` routine in Delphi, but you can certainly create your own version that mimics the functionality of `Format` by parsing a formatted string and extracting the corresponding values into variables. Here's a simple implementation of an `UnFormat` routine in Delphi that can handle formatted ...
7,250
[ { "from": "human", "value": "Has anyone written an 'UnFormat' routine for Delphi?\nWhat I'm imagining is the inverse of SysUtils.Format and looks something like this \nUnFormat('a number %n and another %n',[float1, float2]); \nSo you could unpack a string into a series of variables using format strings.\n...
When a branch is reintegrated to the trunk, is that branch effectively dead? Can you make modifications to the branch after the reintegration and merge those back into the trunk at a later date?
When a branch is reintegrated into the trunk (or main branch) in version control systems like Git, the branch itself isn't technically "dead" in the sense that it can no longer be modified. However, the common practice is that once a branch has been merged into the trunk, it is typically considered complete or finished...
10,501
[ { "from": "human", "value": "When a branch is reintegrated to the trunk, is that branch effectively dead? \nCan you make modifications to the branch after the reintegration and merge those back into the trunk at a later date?\n" }, { "from": "gpt", "value": "When a branch is reintegrated into t...
What is the maximum value of an int in ChucK? Is there a symbolic constant for it?
In ChucK, the maximum value of an `int` is defined by the underlying system's implementation of integers. ChucK itself does not have a predefined symbolic constant for the maximum value of an `int`. However, typically, in many programming languages, the maximum value of a signed integer is \( 2^{31} - 1 \) (i.e., 2,147...
11,345
[ { "from": "human", "value": "What is the maximum value of an int in ChucK? Is there a symbolic constant for it?\n" }, { "from": "gpt", "value": "In ChucK, the maximum value of an `int` is defined by the underlying system's implementation of integers. ChucK itself does not have a predefined symb...
I am using the AJAX Control Toolkit Popup Calendar Control in a datagrid. When it is in the footer it looks fine. When it is in the edit side of the datagrid it is inheriting the style from the datagrid and looks completely different (i.e. too big). Is there a way to alter the CSS so that it does not inherit the style...
Yes, you can override the styles that the Popup Calendar Control inherits from the DataGrid by applying specific CSS rules to target the calendar and reset its styles. Here are some strategies you can use: ### 1. Use Specific CSS Selectors If the Popup Calendar Control is being affected by the styles of the DataGrid,...
6,316
[ { "from": "human", "value": "I am using the AJAX Control Toolkit Popup Calendar Control in a datagrid. When it is in the footer it looks fine. When it is in the edit side of the datagrid it is inheriting the style from the datagrid and looks completely different (i.e. too big). \nIs there a way to alter the...
How can I execute a.exe using the Cygwin shell? I created a C file in Eclipse on Windows and then used Cygwin to navigate to the directory. I called gcc on the C source file and a.exe was produced. I would like to run a.exe.
To execute a Windows executable (like `a.exe`) using the Cygwin shell, you can follow these steps: 1. **Open Cygwin Terminal**: Start by opening your Cygwin terminal. 2. **Navigate to the Directory**: Use the `cd` command to navigate to the directory where `a.exe` is located. For example: ```bash cd /path/to/yo...
9,826
[ { "from": "human", "value": "How can I execute a.exe using the Cygwin shell?\nI created a C file in Eclipse on Windows and then used Cygwin to navigate to the directory. I called gcc on the C source file and a.exe was produced. I would like to run a.exe.\n" }, { "from": "gpt", "value": "To execu...
Given a list, how would I select a new list, containing a slice of the original list (Given offset and number of elements) ? EDIT: Good suggestions so far. Isn't there something specified in one of the SRFI's? This appears to be a very fundamental thing, so I'm surprised that I need to implement it in user-land.
In Scheme, you can create a new list from an existing list using offsets and a specified number of elements. Although there are many ways to accomplish this, some Scheme libraries or SRFI (Scheme Requests for Implementation) may provide built-in functions for slicing lists, such as SRFI-1, which deals with list-process...
8,602
[ { "from": "human", "value": "Given a list, how would I select a new list, containing a slice of the original list (Given offset and number of elements) ?\nEDIT:\nGood suggestions so far. Isn't there something specified in one of the SRFI's? This appears to be a very fundamental thing, so I'm surprised that ...
In textmate, when there's a current selection, I hit the " key and the selection gets surrounded by quotes. The same thing happens with other balanced characters like (, {, [ and '. Am I missing something obvious in Emacs configuration that would enable similar behaviour when using transient mark mode, or do I need to ...
In Emacs, to achieve behavior similar to TextMate where a selection is automatically surrounded by quotes or other balanced characters, you can make use of the built-in functionality along with a bit of configuration. Here's how you can set it up: 1. **Enable Transient Mark Mode**: This mode is usually enabled by de...
7,336
[ { "from": "human", "value": "In textmate, when there's a current selection, I hit the \" key and the selection gets surrounded by quotes. The same thing happens with other balanced characters like (, {, [ and '.\nAm I missing something obvious in Emacs configuration that would enable similar behaviour when ...
I have a project where I would like to generate a report export in MS Word format. The report will include images/graphs, tables, and text. What is the best way to do this? Third party tools? What are your experiences?
Generating a report in MS Word format that includes images, graphs, tables, and text can be done using several methods, depending on your project's specific needs, budget, and your programming skills. Here are some popular options: ### 1. **Microsoft Word Interop (for .NET applications)** If you are working in a .NET...
5,182
[ { "from": "human", "value": "I have a project where I would like to generate a report export in MS Word format. The report will include images/graphs, tables, and text. What is the best way to do this? Third party tools? What are your experiences?\n" }, { "from": "gpt", "value": "Generating ...
I want to serve a lot of big files in a Plone site. By big files I mean around 5MB (music) and a lot of them. I've already do it straight to the ZODB, not a good idea. I'm running Plone 3.1.1 and Zope 2.10.6.
Serving large files directly from the ZODB in a Plone site is generally not advisable due to performance concerns and potential scalability issues. Instead, you can optimize your setup for handling large files by following these steps: ### 1. Use the File System for Storage Instead of storing large files directly in ...
6,750
[ { "from": "human", "value": "I want to serve a lot of big files in a Plone site. By big files I mean around 5MB (music) and a lot of them. I've already do it straight to the ZODB, not a good idea. I'm running Plone 3.1.1 and Zope 2.10.6.\n" }, { "from": "gpt", "value": "Serving large files direc...
Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster. Specifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not available I would like to redirect traffic to ...
Yes, you can configure a WCF service to support failover endpoints using the `EndpointBehavior` and the `ChannelFactory` mechanism. The general approach involves creating a custom behavior to handle the logic of switching between the primary and failover endpoints. Here’s a general outline of how you could implement t...
5,694
[ { "from": "human", "value": "Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster.\nSpecifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not avai...
From browsing on this site and elsewhere, I've learned that serving websites as XHTML at present is considered harmful. Delivering XHTML and serving it as application/xhtml+xml isn't supported by the majority of people browsing at present, delivering xhtml as text/html is at best a placebo for myself, and at worst a re...
Yes, you can use SVG or other XML-based languages within an HTML 4.01 document, but there are specific considerations and limitations to keep in mind. Here are the key points: ### 1. Serving as HTML 4.01 If you serve your page as `text/html` and use the HTML 4.01 doctype, the browser will treat your document as HTML....
5,878
[ { "from": "human", "value": "From browsing on this site and elsewhere, I've learned that serving websites as XHTML at present is considered harmful.\nDelivering XHTML and serving it as application/xhtml+xml isn't supported by the majority of people browsing at present, delivering xhtml as text/html is at be...
For example, given a type param method i'm looking for something like the part in bold void MyMethod< T >() { if ( typeof(T).Implements( IMyInterface ) ) { //Do something else //Do something else } Anwers using C# 3.0 are also welcome, but first drop the .NET 2.0 ones please ;)
In C#, you cannot directly check if a generic type parameter `T` implements an interface at runtime using `typeof(T)` in the way you've described, especially prior to C# 7.3. However, you can accomplish this by using `typeof(T).GetInterfaces()` or `typeof(T).GetInterface()` methods. Here's a solution that works in C# 3...
9,255
[ { "from": "human", "value": "For example, given a type param method i'm looking for something like the part in bold\n\nvoid MyMethod< T >() {\n if ( typeof(T).Implements( IMyInterface ) )\n {\n //Do something \n\nelse\n //Do something else \n\n}\n\nAnwers using C# 3.0 are also welcome, but first drop ...
If you're creating a temporary table within a stored procedure and want to add an index or two on it, to improve the performance of any additional statements made against it, what is the best approach? Sybase says this: "the table must contain data when the index is created. If you create the temporary table and create...
When working with temporary tables in Sybase and focusing on performance, especially regarding indexes, the approach you take can significantly affect the optimizer's ability to generate efficient execution plans. Here are some best practices and considerations based on your context: ### 1. Create the Table and Indexe...
7,434
[ { "from": "human", "value": "If you're creating a temporary table within a stored procedure and want to add an index or two on it, to improve the performance of any additional statements made against it, what is the best approach? Sybase says this:\n\"the table must contain data when the index is created. I...
For my school work, I do a lot of switching computers (from labs to my laptop to the library). I'd kind of like to put this code under some kind of version control. Of course the problem is that I can't always install additional software on the computers I use. Is there any kind of version control system that I can ...
Great choice with Bazaar and TortoiseBzr! Both tools provide a flexible way to manage your version control needs, and the fact that you can run them from a thumb drive makes them ideal for your situation. Here are a few additional options you might consider, if you ever want to explore more: 1. **Git**: While Git is ...
10,689
[ { "from": "human", "value": "For my school work, I do a lot of switching computers (from labs to my laptop to the library). I'd kind of like to put this code under some kind of version control. Of course the problem is that I can't always install additional software on the computers I use. Is there any k...
I'm curious about people's approaches to using stored procedures in a database that is accessed by many applications. Specifically, do you tend to keep different sets of stored procedures for each application, do you try to use a shared set, or do you do a mix? On the one hand, reuse of SPs allows for fewer changes whe...
Your question raises some important considerations when managing stored procedures (SPs) in a multi-application environment. Here’s a breakdown of the pros and cons of different approaches, as well as some recommendations based on your situation: ### 1. **Shared Stored Procedures** **Pros:** - **Consistency**: A share...
4,181
[ { "from": "human", "value": "I'm curious about people's approaches to using stored procedures in a database that is accessed by many applications. Specifically, do you tend to keep different sets of stored procedures for each application, do you try to use a shared set, or do you do a mix?\nOn the one hand,...
What's the best way to use QT4's QItemDelegate to show thumbnails for images in a view? Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)? Can anyone link to some example code that achieves this? Then again, perhaps this isn't the place to look ...
Using QItemDelegate in Qt to display thumbnails for images can be a bit tricky, especially when dealing with very large files, as generating pixmaps from large images can block the main GUI thread. To address this, you can utilize a background thread to handle the image loading and processing, and then update the view ...
5,315
[ { "from": "human", "value": "What's the best way to use QT4's QItemDelegate to show thumbnails for images in a view? \nSpecifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)?\nCan anyone link to some example code that achieves this? Then a...
I have an application that tracks high scores in a game. I have a user_scores table that maps a user_id to a score. I need to return the 5 highest scores, but only 1 high score for any specific user. So if user X has the 5 highest scores on a purely numerical basis, I simply return the highest one and then the next 4 ...
The issue you’re encountering is because `GROUP BY` in your query is not being used correctly. When you use `GROUP BY` without an aggregate function like `MAX`, `MIN`, etc., and you select fields that are not part of the `GROUP BY` clause, MySQL will return unpredictable results. To achieve what you want (i.e., return...
11,549
[ { "from": "human", "value": "I have an application that tracks high scores in a game. \nI have a user_scores table that maps a user_id to a score.\nI need to return the 5 highest scores, but only 1 high score for any specific user.\nSo if user X has the 5 highest scores on a purely numerical basis, I simply...
Simple question, how do you list the primary key of a table with T-SQL? I know how to get indexes on a table, but can't remember how to get the PK.
To list the primary key of a table in T-SQL, you can query the `INFORMATION_SCHEMA` views or use system catalog views. Here are two common approaches: ### Method 1: Using `INFORMATION_SCHEMA.TABLE_CONSTRAINTS` You can query the `INFORMATION_SCHEMA.TABLE_CONSTRAINTS` view along with `INFORMATION_SCHEMA.KEY_COLUMN_USAG...
9,246
[ { "from": "human", "value": "Simple question, how do you list the primary key of a table with T-SQL? I know how to get indexes on a table, but can't remember how to get the PK.\n" }, { "from": "gpt", "value": "To list the primary key of a table in T-SQL, you can query the `INFORMATION_SCHEMA` vi...
Looking for a Linux application (or Firefox extension) that will allow me to scrape an HTML mockup and keep the page's integrity. Firefox does an almost perfect job but doesn't grab images referenced in the CSS. The Scrapbook extension for Firefox gets everything, but flattens the directory structure. I wouldn't terri...
If you're looking to scrape an HTML page and maintain its structure, including images referenced in CSS, there are several options you can explore for Linux, including standalone applications and Firefox extensions. Here are a few recommendations: ### Standalone Applications 1. **HTTrack**: - HTTrack is a powerful...
8,646
[ { "from": "human", "value": "Looking for a Linux application (or Firefox extension) that will allow me to scrape an HTML mockup and keep the page's integrity.\nFirefox does an almost perfect job but doesn't grab images referenced in the CSS.\nThe Scrapbook extension for Firefox gets everything, but flattens...
I have 2 strings that I'd like to compare, and return the positions of the different characters in the second string. For example, if I have "The brown fox jumps over the lazy dog" "The quick brown fox jumped over the lazy dog" I want it to highlight "quick" and "ed". What's the best way to go about this in PHP?
You can achieve this by comparing the two strings character by character and collecting the positions of the characters that differ. You can then extract the substrings that differ based on those positions. Here's a PHP function that accomplishes this: ```php function compareStrings($str1, $str2) { $diffPositions ...
5,848
[ { "from": "human", "value": "I have 2 strings that I'd like to compare, and return the positions of the different characters in the second string. \nFor example, if I have \n\n\"The brown fox jumps over the lazy dog\"\n\"The quick brown fox jumped over the lazy dog\"\n\nI want it to highlight \"quick\" and ...
Is anyone aware of a multi-format file viewer, capable of displaying common image formats, as well as MS Office document formats (at least Word and Excel), and PDFs? I've seen several image viewers available, but none besides Outside In from Oracle. I'm looking for viewer technology that can be imbedded in a .net appl...
Yes, there are several multi-format file viewers available that can display common image formats, MS Office documents (like Word and Excel), and PDFs, which can be embedded into a .NET application. Here are a few options to consider: 1. **Aspose.Total for .NET**: This is a powerful suite that includes libraries for ha...
9,296
[ { "from": "human", "value": "Is anyone aware of a multi-format file viewer, capable of displaying common image formats, as well as MS Office document formats (at least Word and Excel), and PDFs? I've seen several image viewers available, but none besides Outside In from Oracle.\nI'm looking for viewer tech...
I have a solution in Visual Studio 2005(professional Edition) which in turn has 8 projects.I am facing a problem that even after i set the Command Arguments in the Project settings of the relevant project, it doesnt accept those command line arguments and it shows argc = 1, inspite of me giving more than 1 command argu...
It sounds like you're having an issue with passing command line arguments to a project in your Visual Studio 2005 solution. Here are a few steps you can take to troubleshoot the issue: 1. **Check the Project Settings**: - Right-click on the project in Solution Explorer and select **Properties**. - Navigate to th...
8,789
[ { "from": "human", "value": "I have a solution in Visual Studio 2005(professional Edition) which in turn has 8 projects.I am facing a problem that even after i set the Command Arguments in the Project settings of the relevant project, it doesnt accept those command line arguments and it shows argc = 1, insp...
Almost every Java book I read talks about using the interface as a way to share state and behaviour between objects that when first "constructed" did not seem to share a relationship. However, whenever I see architects design an application, the first thing they do is start programming to an interface. How come? How d...
You've raised some important and insightful points about interfaces in Java, and they touch upon fundamental concepts in object-oriented design. Let’s break this down to understand why architects often start with interfaces and the considerations behind choosing interfaces over abstract classes. ### Why Use Interfaces...
6,887
[ { "from": "human", "value": "Almost every Java book I read talks about using the interface as a way to share state and behaviour between objects that when first \"constructed\" did not seem to share a relationship. \nHowever, whenever I see architects design an application, the first thing they do is start ...
I need to attach a file with mailx but at the moment I am not having success. Here's my code: subject="Something happened" to="somebody@somewhere.com" body="Attachment Test" attachment=/path/to/somefile.csv uuencode $attachment | mailx -s "$subject" "$to" << EOF The message is ready to be sent with the following file...
Your approach for sending an email with an attachment using `mailx` and `uuencode` is almost correct, but there are a few adjustments you can make to ensure it works properly. Here is a modified version of your script with comments to guide you: ```bash subject="Something happened" to="somebody@somewhere.com" body="At...
9,350
[ { "from": "human", "value": "I need to attach a file with mailx but at the moment I am not having success.\nHere's my code:\nsubject=\"Something happened\"\nto=\"somebody@somewhere.com\"\nbody=\"Attachment Test\"\nattachment=/path/to/somefile.csv\n\nuuencode $attachment | mailx -s \"$subject\" \"$to\" << EO...
How do you usually go about separating your codebase and associated unit tests? I know people who create a separate project for unit tests, which I personally find confusing and difficult to maintain. On the other hand, if you mix up code and its tests in a single project, you end up with binaries related to your unit ...
Separating your codebase and unit tests can indeed be a challenging task, as you want to maintain a clean architecture while also ensuring that your testing framework does not leak into your production binaries. Here are some strategies and practices that can help you manage this separation effectively: ### 1. **Separ...
7,681
[ { "from": "human", "value": "How do you usually go about separating your codebase and associated unit tests? I know people who create a separate project for unit tests, which I personally find confusing and difficult to maintain. On the other hand, if you mix up code and its tests in a single project, you e...
I am trying to use the InternalsVisibleTo assembly attribute to make my internal classes in a .NET class library visible to my unit test project. For some reason, I keep getting an error message that says: 'MyClassName' is inaccessible due to its protection level Both assemblies are signed and I have the correct key...
The `InternalsVisibleTo` attribute in .NET allows you to expose internal members of an assembly to another specified assembly, which is particularly useful for unit testing. If you're receiving an error message like `'MyClassName' is inaccessible due to its protection level`, it indicates that there may be issues with ...
7,140
[ { "from": "human", "value": "I am trying to use the InternalsVisibleTo assembly attribute to make my internal classes in a .NET class library visible to my unit test project. For some reason, I keep getting an error message that says:\n\n'MyClassName' is inaccessible due to its protection level\n\nBoth ass...
What's the penetration of design patterns in the real world? Do you use them in your day to day job - discussing how and where to apply them with your coworkers - or do they remain more of an academic concept? Do they actually provide actual value to your job? Or are they just something that people talk about to sound...
Design patterns have a significant presence in real-world software development, though their application can vary widely depending on the context, the team’s experience, and the specific project requirements. Here are several key points to consider regarding the penetration of design patterns in the real world: ### 1....
2,104
[ { "from": "human", "value": "What's the penetration of design patterns in the real world? Do you use them in your day to day job - discussing how and where to apply them with your coworkers - or do they remain more of an academic concept? \nDo they actually provide actual value to your job? Or are they just...
What Fortran compilers are there in this day and age, and which would you recommend? Please list the version of Fortran it supports, the platform it works on (e.g. *nix / Windows), and whether it cost money. (Standard OS one per answer etc.)
Here are some Fortran compilers available as of 2023, along with their supported Fortran versions, platforms, and cost considerations: ### 1. GNU Fortran (GFortran) - **Supported Fortran Version**: Fortran 77, 90, 95, 2003, 2008, and partial support for 2018. - **Platform**: Cross-platform (Linux, macOS, Windows). - *...
8,887
[ { "from": "human", "value": "What Fortran compilers are there in this day and age, and which would you recommend? Please list the version of Fortran it supports, the platform it works on (e.g. *nix / Windows), and whether it cost money.\n(Standard OS one per answer etc.)\n" }, { "from": "gpt", "...