instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Ok,I'm running a setup with a single master and a number of slaves. All writes go through the master and are replicated down to the slaves which are used strictly for reads. Now I have a stored procedure (not function) which is called by a trigger on an insert. According to the MySQL docs, for replication triggers log...
In MySQL replication, the behavior of triggers and stored procedures during replication can indeed lead to some confusion. Let's clarify how this works in your scenario: 1. **Triggers and Stored Procedures**: When a trigger is fired on an insert operation, the trigger code (including any calls to stored procedures) is...
9,090
[ { "from": "human", "value": "Ok,I'm running a setup with a single master and a number of slaves. All writes go through the master and are replicated down to the slaves which are used strictly for reads. \nNow I have a stored procedure (not function) which is called by a trigger on an insert. According to th...
I'm trying to provide a link to my company's website from a Windows Form. I want to be well behaved and launch using the user's preferred browser. What is the best way to open a URL in the user's default browser from a Windows Forms application?
To open a URL in the user's default web browser from a Windows Forms application, you can use the `Process.Start` method provided by the `System.Diagnostics` namespace. This approach is the standard way to launch external applications, including web browsers, and it respects the user's default settings. Here’s a simpl...
9,662
[ { "from": "human", "value": "I'm trying to provide a link to my company's website from a Windows Form. I want to be well behaved and launch using the user's preferred browser.\nWhat is the best way to open a URL in the user's default browser from a Windows Forms application?\n" }, { "from": "gpt", ...
I've got a search results page that basically consists of a repeater with content in it. What I need is a way to paginate the results. Getting paginated results isn't the problem, what I'm after is a web control that will display a list of the available paged data, preferably by providing the number of results and a ...
To implement pagination for your search results, you will need to create a web control that allows users to navigate through the pages of results effectively. Here’s a simple approach on how you can achieve this in a typical web application environment. ### Basic Concept for Pagination Control 1. **Determine Total P...
6,175
[ { "from": "human", "value": "I've got a search results page that basically consists of a repeater with content in it. What I need is a way to paginate the results. Getting paginated results isn't the problem, what I'm after is a web control that will display a list of the available paged data, preferably ...
Pros. and cons? how long do you use it? What about jambi?
It seems like you're asking for a general overview of the pros and cons of a particular subject, as well as information about "Jambi." However, you didn't specify what "it" refers to. If you're asking about a specific product, service, or concept, please clarify. Regarding Jambi, it can refer to various things, but th...
13,208
[ { "from": "human", "value": "Pros. and cons? how long do you use it? What about jambi?\n" }, { "from": "gpt", "value": "It seems like you're asking for a general overview of the pros and cons of a particular subject, as well as information about \"Jambi.\" However, you didn't specify what \"it\"...
A while ago, I came across some code that marked a data member of a class with the mutable keyword. As far as I can see it simply allows you to modify a member in a const-qualified member method: class Foo { private: mutable bool done_; public: void doSomething() const { ...; done_ = true; } }; Is...
The `mutable` keyword in C++ serves a specific purpose beyond just allowing modification of class members in `const` member functions. Here’s a breakdown of its uses and implications: ### Primary Use Case The primary role of `mutable` is to allow a member variable to be modified even in a `const` member function. Thi...
8,851
[ { "from": "human", "value": "A while ago, I came across some code that marked a data member of a class with the mutable keyword. As far as I can see it simply allows you to modify a member in a const-qualified member method:\nclass Foo \n{ \nprivate: \n mutable bool done_; \npublic: \n void doSo...
What happens if I use SHGetFolderPath api call in a 32 bit system with CSIDL_PROGRAM_FILESx86 folder id instead of the CSIDL_PROGRAM_FILES id? Theoretically CSIDL_PROGRAM_FILESx86 should map to C:\program files (x86) in a 64 bit system but what does it map to in a 32 bit system where this path doesn't exist?
In a 32-bit system, the `CSIDL_PROGRAM_FILESx86` constant is not defined and is effectively treated as an invalid value. When you attempt to use the `SHGetFolderPath` API with `CSIDL_PROGRAM_FILESx86` on a 32-bit system, it typically results in the API returning an error or an empty path, as there is no corresponding f...
11,811
[ { "from": "human", "value": "What happens if I use SHGetFolderPath api call in a 32 bit system with CSIDL_PROGRAM_FILESx86 folder id instead of the CSIDL_PROGRAM_FILES id?\nTheoretically CSIDL_PROGRAM_FILESx86 should map to C:\\program files (x86) in a 64 bit system but what does it map to in a 32 bit syste...
My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix: select PTNO,PTNM,CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CATCD); and here it is after the fix: s...
The confusion you're experiencing stems from the way SQL handles column references when dealing with joins, particularly with left joins. Let's clarify the issue and understand why you were getting unexpected results without an error being thrown. ### Understanding the Original Query In your original query: ```sql s...
6,619
[ { "from": "human", "value": "My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix:\nselect PTNO,PTNM,CATCD\nfrom PARTS \nleft join CATEGORIES on (CATEGORIES.CATCD=PAR...
After test driving Google Chrome for 30 minutes or so, I like it, even if it seems bare-bones at the moment. The obvious way to add a few things I can't live without would be through plugins. Does anyone have any links to resources on how to get started building a plugin/addon for Chrome? Thanks.
Building a Chrome extension can be a rewarding project! Here are some resources to help you get started: ### Official Documentation 1. **Chrome Extensions Documentation**: The official documentation is a great place to start. It covers everything from the basics to advanced topics. - [Chrome Extensions Documentatio...
4,029
[ { "from": "human", "value": "After test driving Google Chrome for 30 minutes or so, I like it, even if it seems bare-bones at the moment. The obvious way to add a few things I can't live without would be through plugins. Does anyone have any links to resources on how to get started building a plugin/addon...
How do I see if a certain object has been loaded, and if not, how can it be loaded, like the following? if (!isObjectLoaded(someVar)) { someVar= loadObject(); }
In many programming languages, the concept of checking if an object has been loaded or instantiated typically involves checking if the object reference is `null` or not. The exact approach can vary based on the language you're using, but the general idea remains the same. Below are examples in several popular programmi...
9,132
[ { "from": "human", "value": "How do I see if a certain object has been loaded, and if not, how can it be loaded, like the following?\nif (!isObjectLoaded(someVar)) {\n someVar= loadObject();\n}\n\n" }, { "from": "gpt", "value": "In many programming languages, the concept of checking if an obj...
On a class library project, I set the "Start Action" on the Debug tab of the project properties to "Start external program" (NUnit in this case). I want to set an environment variable in the environment this program is started in. How do I do that? (Is it even possible?) EDIT: It's an environment variable that influenc...
In Visual Studio, when you configure a project to start an external program (like NUnit), you don’t have direct access to set environment variables for that specific execution context. However, you can use a few workarounds to achieve this without setting system-wide environment variables. ### Workaround 1: Batch File...
8,994
[ { "from": "human", "value": "On a class library project, I set the \"Start Action\" on the Debug tab of the project properties to \"Start external program\" (NUnit in this case). I want to set an environment variable in the environment this program is started in. How do I do that? (Is it even possible?)\nED...
I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate.
When you apply AES (Advanced Encryption Standard) encryption to data, the output does typically increase in size compared to the original plaintext. This size increase is primarily due to the following reasons: 1. **Padding**: AES operates on blocks of a fixed size (16 bytes for AES). If the plaintext isn't a multiple...
10,520
[ { "from": "human", "value": "I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate.\n" }, { "from": "gpt", "value": "When yo...
I am planning to extend the basic html input tag provided by Spring to incorporate more features into it. I did similar kind of exercise in past for Struts too. At that point of time I had to create a tld file with the attributes that I introduced plus all the attributes available in the parent tag. This is bit tiresom...
In JSP, Tag Library Descriptors (TLD) are used to define custom tags and their attributes. Unfortunately, TLD files do not support inheritance in the traditional sense, meaning you cannot directly extend an existing TLD definition to create a new one with additional attributes. However, you can adopt some strategies to...
8,003
[ { "from": "human", "value": "I am planning to extend the basic html input tag provided by Spring to incorporate more features into it. I did similar kind of exercise in past for Struts too. At that point of time I had to create a tld file with the attributes that I introduced plus all the attributes availab...
In C#, if you have multiple constructors, you can do something like this: public MyClass(Guid inputId, string inputName){ // do something } public MyClass(Guid inputId): this(inputId, "foo") {} The idea is of course code reuse. However, what is the best approach when there is a bit of complex logic needed? Say I ...
In C#, constructors cannot call each other in a way that allows you to perform complex logic and then proceed to invoke another constructor directly. However, there are various ways to work around this limitation, especially considering that you want to manage the lifecycle of a disposable object. Given your situation...
7,872
[ { "from": "human", "value": "In C#, if you have multiple constructors, you can do something like this:\npublic MyClass(Guid inputId, string inputName){\n // do something\n}\n\npublic MyClass(Guid inputId): this(inputId, \"foo\") {}\n\nThe idea is of course code reuse. However, what is the best approach w...
I'm obviously not talking about a full solution, but just a good starting point for common applications for software architects. It could be for a CMS, e-commerce storefront, address book, etc. A UML diagram is not essential, but a table schema with data types in the least. Thanks!
Sure! Here are some common applications along with a basic table schema for each. These schemas can provide a good starting point for software architects when designing the database structure. ### 1. Content Management System (CMS) #### Tables | Table Name | Column Name | Data Type | Description ...
4,573
[ { "from": "human", "value": "I'm obviously not talking about a full solution, but just a good starting point for common applications for software architects. It could be for a CMS, e-commerce storefront, address book, etc. A UML diagram is not essential, but a table schema with data types in the least. Than...
How can I start an interactive console for Perl, similar to the irb command for Ruby or python for Python?
You can start an interactive console for Perl using the `perl -d` command, which invokes the Perl debugger. While this is not specifically designed as an interactive shell, it does allow you to run Perl code interactively. However, for a more user-friendly experience similar to Ruby's `irb` or Python's REPL, you can us...
10,267
[ { "from": "human", "value": "How can I start an interactive console for Perl, similar to the irb command for Ruby or python for Python?\n" }, { "from": "gpt", "value": "You can start an interactive console for Perl using the `perl -d` command, which invokes the Perl debugger. While this is not s...
I want to add a constant value onto an incoming bound integer. In fact I have several places where I want to bind to the same source value but add different constants. So the ideal solution would be something like this... <TextBox Canvas.Top="{Binding ElementName=mySource, Path=myInt, Constant=5}"/> <TextBox Canvas.Top...
In WPF, you can't directly specify constants in bindings as you described. However, you can achieve the desired functionality in a more elegant way by using a `ValueConverter`. A value converter allows you to transform the value from the binding before it is set on the target property. Here's how you can implement it:...
10,401
[ { "from": "human", "value": "I want to add a constant value onto an incoming bound integer. In fact I have several places where I want to bind to the same source value but add different constants. So the ideal solution would be something like this...\n<TextBox Canvas.Top=\"{Binding ElementName=mySource, Pat...
I'm building a toy database in C# to learn more about compiler, optimizer, and indexing technology. I want to maintain maximum parallelism between (at least read) requests for bringing pages into the buffer pool, but I am confused about how best to accomplish this in .NET. Here are some options and the problems I've co...
It sounds like you're working on an interesting project! Your concerns about maintaining parallelism while reading from a file are valid, especially when you're aiming to create a more efficient database. Let's evaluate the options you've outlined, considering their implications for parallelism and efficiency. ### Opt...
5,221
[ { "from": "human", "value": "I'm building a toy database in C# to learn more about compiler, optimizer, and indexing technology.\nI want to maintain maximum parallelism between (at least read) requests for bringing pages into the buffer pool, but I am confused about how best to accomplish this in .NET.\nHer...
I am in charge of about 100+ documents (word document, not source code) that needs revision by different people in my department. Currently all the documents are in a shared folder where they will retrieve, revise and save back into the folder. What I am doing now is looking up the "date modified" in the shared folder...
It sounds like you're looking for a more efficient way to manage revisions and track changes in your department’s documents. Here are a few options you might consider, based on your findings and preferences: ### 1. Google Docs Since you've already experimented with Google Docs and found its revision feature useful, it...
8,797
[ { "from": "human", "value": "I am in charge of about 100+ documents (word document, not source code) that needs revision by different people in my department. Currently all the documents are in a shared folder where they will retrieve, revise and save back into the folder. \nWhat I am doing now is looking u...
I have a web app which connects to a server using a TCP connection and reads a binary document which it then writes to its response object. In other words it's transferring a file from a backend server using a custom protocol and returning that file to its client through HTTP. The server sends a status code and a mime ...
The issue you're encountering is likely due to the use of `stream_.DataAvailable`, which checks if there is data available to read at that moment. However, this does not guarantee that all the data has been sent from the server, especially if the server is sending a large file over a TCP connection. When `DataAvailable...
9,883
[ { "from": "human", "value": "I have a web app which connects to a server using a TCP connection and reads a binary document which it then writes to its response object. In other words it's transferring a file from a backend server using a custom protocol and returning that file to its client through HTTP.\n...
The method signature of a Java mainmethod is: public static void main(String[] args) { ... } Is there a reason why this method must be static?
Yes, the `main` method in Java must be static for a few important reasons: 1. **Entry Point of the Program**: The `main` method is the entry point for any standalone Java application. When the Java Virtual Machine (JVM) starts executing a Java application, it looks for the `main` method to begin execution. If `main` w...
12,142
[ { "from": "human", "value": "The method signature of a Java mainmethod is:\npublic static void main(String[] args) {\n ...\n}\n\nIs there a reason why this method must be static?\n" }, { "from": "gpt", "value": "Yes, the `main` method in Java must be static for a few important reasons:\n\n1. ...
How to implement multi-threading in visual basic 6.0. It would be great if someone can give an example.
Visual Basic 6.0 does not natively support multi-threading in the way that more modern languages do. However, you can achieve multi-threading behavior by using the Windows API to create threads or by utilizing ActiveX EXE components to run code in separate threads. Here’s a simple example using an ActiveX EXE to simul...
8,140
[ { "from": "human", "value": "How to implement multi-threading in visual basic 6.0. It would be great if someone can give an example.\n" }, { "from": "gpt", "value": "Visual Basic 6.0 does not natively support multi-threading in the way that more modern languages do. However, you can achieve mult...
Is it possible to have one appBase served up by multiple context paths in Tomcat? I have an application base that recently replaced a second application base. My problem is a number of users still access the old context. I would like to serve the, now common, application from a single appBase yet accessed via either ...
In Apache Tomcat, it's not possible to directly serve the same application from multiple context paths within a single appBase without some workarounds, like the symbolic link you've implemented. However, there are a few different approaches you can consider to achieve this without resorting to symbolic links or duplic...
9,948
[ { "from": "human", "value": "Is it possible to have one appBase served up by multiple context paths in Tomcat?\nI have an application base that recently replaced a second application base. My problem is a number of users still access the old context. I would like to serve the, now common, application from...
I'm using VS2008 to debug an application that starts a new process. I believe that the spawned process is suffering (and handling) some kind of CLR exception during its start-up, but it is not being caught by turning on CLR Exception Notification in Debug -> Exceptions. Any suggestions on how I can see where the except...
Debugging exceptions in a spawned process, particularly in .NET applications, can be tricky. Here are a few strategies you can use in Visual Studio 2008 to catch exceptions during the startup of a new process: 1. **Set an Environment Variable**: You can configure the application to wait for a debugger to attach before...
10,760
[ { "from": "human", "value": "I'm using VS2008 to debug an application that starts a new process. I believe that the spawned process is suffering (and handling) some kind of CLR exception during its start-up, but it is not being caught by turning on CLR Exception Notification in Debug -> Exceptions. Any sugg...
I am running a number of SSL-encrypted websites, and need to generate certificates to run on these. They are all internal applications, so I don't need to purchase a certificate, I can create my own. I have found it quite tedious to do everything using openssl all the time, and figure this is the kind of thing that has...
Yes, you're right that there are tools available that can help simplify the process of generating SSL certificates, especially for internal applications where purchasing certificates isn’t necessary. Below are some suggestions for command-line tools and methods you can use on Linux-based systems: 1. **Certbot with Sel...
7,168
[ { "from": "human", "value": "I am running a number of SSL-encrypted websites, and need to generate certificates to run on these. They are all internal applications, so I don't need to purchase a certificate, I can create my own.\nI have found it quite tedious to do everything using openssl all the time, and...
What is the best (regarding performance) way to compute the critical path of a directional acyclic graph when the nodes of the graph have weight? For example, if I have the following structure: Node A (weight 3) / \ Node B (weight 4) Node D (weight 7) / ...
To compute the critical path in a Directed Acyclic Graph (DAG) where nodes have weights, you can use a modified version of the longest path algorithm. The goal is to find the path that has the maximum sum of node weights. Here's a step-by-step approach to achieve this: ### Step-by-Step Approach 1. **Topological Sort*...
8,026
[ { "from": "human", "value": "What is the best (regarding performance) way to compute the critical path of a directional acyclic graph when the nodes of the graph have weight?\nFor example, if I have the following structure:\n Node A (weight 3)\n / \\\n Node B (weight ...
Is there a better unit testing tool than WaTiR for Ruby web testing? Or is the defacto standard? What unit testing tools do you use?
WaTiR (Web Application Testing in Ruby) was a popular tool for web testing in Ruby, but the landscape of web testing tools has evolved over the years. While WaTiR may still be useful for some, there are other tools that are now considered more standard or feature-rich for Ruby web testing. ### Popular Unit Testing Too...
10,895
[ { "from": "human", "value": "Is there a better unit testing tool than WaTiR for Ruby web testing? Or is the defacto standard? What unit testing tools do you use?\n" }, { "from": "gpt", "value": "WaTiR (Web Application Testing in Ruby) was a popular tool for web testing in Ruby, but the landscape...
I'm importing a MySQL dump and getting the following error. $ mysql foo < foo.sql ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes Apparently there are attachments in the database, which makes for very large inserts. This is on my local machine, a Mac with MySQL 5 installed from the...
The error you're encountering indicates that the size of a single packet being sent to the MySQL server exceeds the `max_allowed_packet` setting. To resolve this, you'll need to adjust the `max_allowed_packet` variable in your MySQL configuration. Here's how to do that: ### Step 1: Update `max_allowed_packet` in MySQ...
9,855
[ { "from": "human", "value": "I'm importing a MySQL dump and getting the following error.\n$ mysql foo < foo.sql \nERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes\n\nApparently there are attachments in the database, which makes for very large inserts.\n\nThis is on my local...
Along the lines of my previous question, how can i join a list of strings into a string such that values get quoted cleanly. Something like: ['a', 'one "two" three', 'foo, bar', """both"'"""] into: a, 'one "two" three', "foo, bar", "both\"'" I suspect that the csv module will come into play here, but i'm not sure how...
To achieve the desired output of joining a list of strings into a single string with appropriate quoting, you can indeed use the `csv` module in Python. The `csv` module provides a way to write lists of strings to a CSV format, which handles quoting automatically based on the content of the strings. Here is a code sni...
11,561
[ { "from": "human", "value": "Along the lines of my previous question, how can i join a list of strings into a string such that values get quoted cleanly. Something like:\n['a', 'one \"two\" three', 'foo, bar', \"\"\"both\"'\"\"\"]\n\ninto:\na, 'one \"two\" three', \"foo, bar\", \"both\\\"'\"\n\nI suspect th...
In the KornShell (ksh) on AIX UNIX Version 5.3 with the editor mode set to vi using: set -o vi What are the key-strokes at the shell command line to autocomplete a file or directory name?
In KornShell (ksh) with vi mode enabled, you can autocomplete a file or directory name using the following keystrokes: 1. Start typing the beginning of the file or directory name. 2. Press `Esc` to ensure you are in normal mode (if you are in insert mode). 3. Type `Ctrl` + `D` (this is the same as pressing `^D`), whic...
12,615
[ { "from": "human", "value": "In the KornShell (ksh) on AIX UNIX Version 5.3 with the editor mode set to vi using:\nset -o vi\n\nWhat are the key-strokes at the shell command line to autocomplete a file or directory name?\n" }, { "from": "gpt", "value": "In KornShell (ksh) with vi mode enabled, y...
My project is currently using a svn repository which gains several hundred new revisions per day. The repository resides on a Win2k3-server and is served through Apache/mod_dav_svn. I now fear that over time the performance will degrade due to too many revisions. Is this fear reasonable? We are already planning to up...
Your concerns regarding performance degradation over time with a Subversion (SVN) repository that is experiencing several hundred revisions per day are reasonable, but there are a few factors to consider. 1. **Delta Storage**: As you correctly pointed out, Subversion uses a delta storage mechanism that only saves the ...
10,751
[ { "from": "human", "value": "My project is currently using a svn repository which gains several hundred new revisions per day.\nThe repository resides on a Win2k3-server and is served through Apache/mod_dav_svn. \nI now fear that over time the performance will degrade due to too many revisions.\nIs this fe...
I'm having a strange problem in Visual Studio 2008 where my "Pending Checkins" window never updates. I open it up, and it says "Updating..." like usual, but I never see the "X remaining" message, and nothing happens. It just sits there doing nothing. Checked-out stuff still shows as checked out in Solution Explorer. ...
It sounds like you're encountering a common issue with Visual Studio 2008 and SourceSafe integration. Here are some steps you can take to troubleshoot and potentially resolve the "Pending Checkins" window not updating: 1. **Restart Visual Studio**: Sometimes simply restarting Visual Studio can clear up temporary glitc...
9,754
[ { "from": "human", "value": "I'm having a strange problem in Visual Studio 2008 where my \"Pending Checkins\" window never updates. I open it up, and it says \"Updating...\" like usual, but I never see the \"X remaining\" message, and nothing happens. It just sits there doing nothing.\nChecked-out stuff s...
I have a report that I built for a client where I need to plot x 0-100, y 0-100. Let's imagine I have these points: 0, 0 2, 24 50, 70 100, 100 I need to represent these as a smoothed line chart, as the application of it is a dot gain graph for printing presses. Here's the problem. The line draws fine from 100...
It sounds like you're experiencing issues with the curve control in your smoothed line chart due to the spacing of your data points. When you're using a Bézier curve or a similar smoothing algorithm, points that are far apart can cause the curve to behave unexpectedly, especially if there's a sharp change in the value....
7,725
[ { "from": "human", "value": "I have a report that I built for a client where I need to plot x 0-100, y 0-100. Let's imagine I have these points:\n 0, 0\n 2, 24\n 50, 70\n100, 100\n\nI need to represent these as a smoothed line chart, as the application of it is a dot gain graph for printing presses.\n...
I am using Visual Studio, developing a native application, I have a programmatical breakpoint (assert) in my code placed using __asm int 3 or __debugbreak. Sometimes when I hit it, I would like to disable it so that successive hits in the same debugging session no longer break into the debugger. How can I do this?
To temporarily disable a programmatic breakpoint (like the one you set with `__asm int 3` or `__debugbreak`) during a debugging session in Visual Studio, you can employ several approaches. Here are a few methods you might consider: ### 1. Conditional Compilation with a Debug Flag You can use a preprocessor directive t...
8,704
[ { "from": "human", "value": "I am using Visual Studio, developing a native application, I have a programmatical breakpoint (assert) in my code placed using __asm int 3 or __debugbreak. Sometimes when I hit it, I would like to disable it so that successive hits in the same debugging session no longer break ...
I need to write a web application using SQL Server 2005, asp.net, and ado.net. Much of the user data stored in this application must be encrypted (read HIPAA). In the past for projects that required encryption, I encrypted/decrypted in the application code. However, this was generally for encrypting passwords or cred...
Your approach to encrypting sensitive data in SQL Server 2005 using symmetric keys and certificates is fundamentally sound, especially when considering the regulatory requirements such as HIPAA. Below, I’ll address your questions and considerations regarding opening and closing symmetric keys, transaction management, a...
6,528
[ { "from": "human", "value": "I need to write a web application using SQL Server 2005, asp.net, and ado.net. Much of the user data stored in this application must be encrypted (read HIPAA).\nIn the past for projects that required encryption, I encrypted/decrypted in the application code. However, this was ...
Is it possible in a large GWT project, load some portion of JavaScript lazy, on the fly? Like overlays. PS: Iframes is not a solution.
Yes, it's possible to load JavaScript dynamically in a large Google Web Toolkit (GWT) project. While GWT compiles Java code into JavaScript, you can still incorporate additional JavaScript libraries or modules at runtime using a few techniques. Here are some approaches you could consider for lazy loading JavaScript: #...
6,723
[ { "from": "human", "value": "Is it possible in a large GWT project, load some portion of JavaScript lazy, on the fly?\n Like overlays. \nPS: Iframes is not a solution.\n" }, { "from": "gpt", "value": "Yes, it's possible to load JavaScript dynamically in a large Google Web Toolkit (GWT) project...
A Google search for "site:example.com" will tell you the number of pages of example.com that are currently in Google's index. Is it possible to find out how this number has changed over time?
Google does not provide a direct way to track the historical number of indexed pages for a specific site, such as "site:example.com," over time. However, there are a few methods and tools you can use to get an idea of how the number of indexed pages has changed: 1. **Wayback Machine**: The Internet Archive's Wayback M...
11,104
[ { "from": "human", "value": "A Google search for \"site:example.com\" will tell you the number of pages of example.com that are currently in Google's index. Is it possible to find out how this number has changed over time?\n" }, { "from": "gpt", "value": "Google does not provide a direct way to ...
Is there a way to view the key/value pairs of a NSDictionary variable through the Xcode debugger? Here's the extent of information when it is fully expanded in the variable window: Variable Value Summary jsonDict 0x45c540 4 key/value pairs NSObject {...} isa 0xa06e0720 I was expecting it to show me ea...
Yes, you can view the key/value pairs of an `NSDictionary` variable in Xcode's debugger, but sometimes it requires a little extra effort since the default view in the variables window may not show all details. Here are a few methods to inspect the contents of an `NSDictionary` during debugging: 1. **Use the Debugger ...
11,875
[ { "from": "human", "value": "Is there a way to view the key/value pairs of a NSDictionary variable through the Xcode debugger? Here's the extent of information when it is fully expanded in the variable window:\nVariable Value Summary\njsonDict 0x45c540 4 key/value pairs\n NSObject {...}\n isa ...
I've written this very simple function to replace a file extension using LINQ in C#.NET 3.5 however I have a feeling that there's a more elegant way to do this. (I'm not committed to using LINQ here - just looking for a more elegant approach.) Ideas? private string ReplaceFileExtension(string fileName, string newEx...
Certainly! While your current implementation using LINQ does work, you can simplify it further. Instead of splitting the string into an array and then using `String.Join`, you can leverage the `Path` class in the `System.IO` namespace. This is not only more elegant but also handles cases where there might not be a dot ...
11,957
[ { "from": "human", "value": "I've written this very simple function to replace a file extension using LINQ in C#.NET 3.5 however I have a feeling that there's a more elegant way to do this. (I'm not committed to using LINQ here - just looking for a more elegant approach.) Ideas?\n private string ReplaceF...
I have a string that contains the representation of a date. It looks like: Thu Nov 30 19:00:00 EST 2006 I'm trying to create a Date object using SimpleDateFormat and have 2 problems. 1.) I can't figure out the pattern to hard-code the solution into the SimpleDateFormat constructor 2.) I can't find a way I could parse...
To solve your two problems related to parsing a date string in the format you've provided, we'll address them step by step. ### 1. Creating a `SimpleDateFormat` Pattern The date string `Thu Nov 30 19:00:00 EST 2006` can be broken down into its components: - Day of the week: `Thu` - Month: `Nov` - Day of the month: `3...
7,791
[ { "from": "human", "value": "I have a string that contains the representation of a date. It looks like: \nThu Nov 30 19:00:00 EST 2006\nI'm trying to create a Date object using SimpleDateFormat and have 2 problems. \n1.) I can't figure out the pattern to hard-code the solution into the SimpleDateFormat cons...
I'm receiving a recovery feed from an exchange for recovering data missed from their primary feed. The exchange strongly recommends listening to the recovery feed only when data is needed, and leaving the multicast once I have recovered the data I need. My question is, if I am using asio, and not reading from the NIC w...
Using a recovery feed from an exchange is a common practice to ensure that you can retrieve missed data. However, there are specific considerations you should keep in mind when determining whether to continuously listen to the recovery feed, even if you are not actively processing messages. 1. **Resource Usage**: Leav...
8,231
[ { "from": "human", "value": "I'm receiving a recovery feed from an exchange for recovering data missed from their primary feed.\nThe exchange strongly recommends listening to the recovery feed only when data is needed, and leaving the multicast once I have recovered the data I need.\nMy question is, if I am...
I need to find out the file/directory name that a .lnk is pointing to using c#. What is the simplest way to do this? Thanks.
To retrieve the target file or directory that a `.lnk` file is pointing to in C#, you can use the `IWshRuntimeLibrary` COM library, which is part of Windows Script Host. This library provides an easy way to interact with shortcut files (.lnk). Here’s a simple example of how you can accomplish this: 1. **Add a Referen...
10,553
[ { "from": "human", "value": "I need to find out the file/directory name that a .lnk is pointing to using c#.\nWhat is the simplest way to do this?\nThanks.\n" }, { "from": "gpt", "value": "To retrieve the target file or directory that a `.lnk` file is pointing to in C#, you can use the `IWshRunt...
Is it possible to change the font size used in a ContextMenu using the .NET Framework 3.5 and C# for a desktop application? It seems it's a system-wide setting, but I would like to change it only within my application.
In .NET Framework 3.5, the `ContextMenu` (or `ContextMenuStrip` in more modern practices) does not provide a direct way to change the font size for the menu items. The font size for context menus is indeed a system-wide setting that applies to all applications and cannot be changed locally for just one application thro...
9,708
[ { "from": "human", "value": "Is it possible to change the font size used in a ContextMenu using the .NET Framework 3.5 and C# for a desktop application? It seems it's a system-wide setting, but I would like to change it only within my application.\n" }, { "from": "gpt", "value": "In .NET Framew...
I have a dl containing some input boxes that I "clone" with a bit of JavaScript like: var newBox = document.createElement('dl'); var sourceBox = document.getElementById(oldkey); newBox.innerHTML = sourceBox.innerHTML; newBox.id = newkey; document.getElementById('boxes').appendChild(columnBox); In IE,...
The behavior you're experiencing is due to the way browsers handle the cloning of DOM elements. When you use `innerHTML`, it doesn't copy the values of form inputs or other dynamic content. Instead, it just copies the structure (i.e., the HTML elements without the state). To ensure that the values from the form inputs...
7,857
[ { "from": "human", "value": "I have a dl containing some input boxes that I \"clone\" with a bit of JavaScript like: \nvar newBox = document.createElement('dl'); \nvar sourceBox = document.getElementById(oldkey); \nnewBox.innerHTML = sourceBox.innerHTML; \nnewBox.id = newkey; \ndocument.getElement...
I have a table defined (see code snippet below). How can I add a constraint or whatever so that the LastUpdate column is automatically updated anytime the row is changed? CREATE TABLE dbo.Profiles ( UserName varchar(100) NOT NULL, LastUpdate ...
To automatically update the `LastUpdate` column whenever a row in the `Profiles` table is modified, you can use a `TRIGGER`. A trigger allows you to define actions that should occur in response to specific events on the table, such as `INSERT` or `UPDATE`. Here's how you can create an `AFTER UPDATE` trigger for the `P...
9,827
[ { "from": "human", "value": "I have a table defined (see code snippet below). How can I add a constraint or whatever so that the LastUpdate column is automatically updated anytime the row is changed?\nCREATE TABLE dbo.Profiles\n(\n UserName varchar(100) NOT N...
I just wanted to see if I could have your thoughts on the design of some work I am currently doing. Here's the current situation - Basically: I am developing a series of controls for our applications. Some of these may be used in both WinForms and ASP.NET Web applications. I am on a constant endeavor to improve my tes...
Your approach to separating core logic from rendering in your control design is commendable and reflects many best practices in software design, particularly in achieving better testability and maintainability. Let’s dive deeper into your design and the MVP (Model-View-Presenter) pattern you mentioned: ### Thoughts on...
9,516
[ { "from": "human", "value": "I just wanted to see if I could have your thoughts on the design of some work I am currently doing.\nHere's the current situation - Basically:\n\nI am developing a series of controls for our applications.\nSome of these may be used in both WinForms and ASP.NET Web applications.\...
I'm using VMware Workstation 6.0 for simulation of tight clusters of "blades" in a "chassis". Both the host and target OSs are Linux. Each "chassis" uses a vmnet switch as a virtual backplane, to which the virtual blades connect. Other vmnet switches are used to mediate point-to-point connections between mutiple virtua...
Moving from VMware Workstation to VMware ESX (or its successor, vSphere/ESXi) presents several differences and considerations that you should keep in mind, especially concerning your specific setup involving tight clusters of "blades," extensive use of the VIX API, and complex network topologies. Below are some of the ...
8,356
[ { "from": "human", "value": "I'm using VMware Workstation 6.0 for simulation of tight clusters of \"blades\" in a \"chassis\". Both the host and target OSs are Linux. Each \"chassis\" uses a vmnet switch as a virtual backplane, to which the virtual blades connect. Other vmnet switches are used to mediate po...
In Python, given a module X and a class Y, how can I iterate or generate a list of all subclasses of Y that exist in module X?
To iterate over or generate a list of all subclasses of a class `Y` that exist in a module `X`, you can use the `inspect` module along with the `issubclass` function. Here's how you can do it: 1. Import the necessary modules. 2. Use `inspect.getmembers()` to retrieve all classes from the module. 3. Check if each class...
11,928
[ { "from": "human", "value": "In Python, given a module X and a class Y, how can I iterate or generate a list of all subclasses of Y that exist in module X?\n" }, { "from": "gpt", "value": "To iterate over or generate a list of all subclasses of a class `Y` that exist in a module `X`, you can use...
I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it. Unfortunately, whilst I know the XML model fairly well in .NET, I'm uncertain what the pros and cons are of the XML models in Python. ...
Python offers several libraries for working with XML, and the choice of which to use depends on your specific needs, preferences, and the complexity of the XML documents you need to handle. Here are some common libraries, along with their pros and cons: ### Libraries for XML Processing in Python 1. **xml.etree.Elemen...
2,274
[ { "from": "human", "value": "I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it. \nUnfortunately, whilst I know the XML model fairly well in .NET, I'm uncertain what the pros an...
I have connected to a server via SFTP using FileZilla and accepted adding the server's SSH key to the key cache in FileZilla. How can I extract this cached key to a keyfile so that may use it through other SFTP applications that require a keyfile be made available? I have not been able to find anything in the FileZ...
FileZilla does not provide a direct way to export the cached SSH keys into a file. However, you can use the following methods to extract or recreate the key for use with other SFTP applications: 1. **Using a Key Manager**: If you have a key manager or a key generation tool, you can manually create a new SSH key pai...
11,055
[ { "from": "human", "value": "I have connected to a server via SFTP using FileZilla and accepted adding the server's SSH key to the key cache in FileZilla. \nHow can I extract this cached key to a keyfile so that may use it through other SFTP applications that require a keyfile be made available? \nI have ...
I once was asked to increase thread priority to fix a problem. I refused, saying that changing it was dangerous and was not the root cause of the problem. My question is, under what circumstannces should I conider changing priority of threads?
Changing the priority of threads can be a powerful tool in managing performance and responsiveness in concurrent applications, but it should be approached with caution. Here are some circumstances under which you might consider adjusting thread priorities: 1. **Real-Time Systems**: In applications that require real-ti...
9,080
[ { "from": "human", "value": "I once was asked to increase thread priority to fix a problem. I refused, saying that changing it was dangerous and was not the root cause of the problem.\nMy question is, under what circumstannces should I conider changing priority of threads?\n" }, { "from": "gpt", ...
Is there any way to create a virtual drive in "(My) Computer" and manipulate it, somewhat like JungleDisk does it? It probably does something like: override OnRead(object sender, Event e) { ShowFilesFromAmazon(); } Are there any API:s for this? Maybe to write to an XML-file or a database, instead of a real drive. ...
Creating a virtual drive that appears in "(My) Computer" (also known as "This PC") and can interact with files, similar to how JungleDisk does it, is indeed possible using the Dokan library. Dokan is a user-mode file system for Windows that allows developers to create custom file systems without needing to write a kern...
5,619
[ { "from": "human", "value": "Is there any way to create a virtual drive in \"(My) Computer\" and manipulate it, somewhat like JungleDisk does it?\nIt probably does something like:\noverride OnRead(object sender, Event e) {\n ShowFilesFromAmazon();\n}\n\nAre there any API:s for this? Maybe to write to an ...
Am I correct in assuming that the only difference between "windows files" and "unix files" is the linebreak? We have a system that has been moved from a windows machine to a unix machine and are having troubles with the format. I need to automate the translation between unix/windows before the files get delivered to th...
You are correct that one of the primary differences between Windows and Unix text files is indeed the line-ending format. Windows uses Carriage Return and Line Feed (CRLF, or `\r\n`), while Unix systems use just Line Feed (LF, or `\n`). Mac OS prior to OS X used Carriage Return (CR, or `\r`) but has since adopted the U...
6,451
[ { "from": "human", "value": "Am I correct in assuming that the only difference between \"windows files\" and \"unix files\" is the linebreak?\nWe have a system that has been moved from a windows machine to a unix machine and are having troubles with the format.\nI need to automate the translation between un...
I often need to implement some sort of rule system that is user-editable -- the requirements are generally different enough that the same system isn't directly applicable, so I frequently run into the same problem--how do I design a rule system that is maintainable properly balances expressiveness with ease of use is ...
Designing a user-editable rule system or Domain-Specific Language (DSL) that balances expressiveness, ease of use, maintainability, and extensibility can indeed be a complex challenge. Here are some design principles, techniques, and references to help you create an effective rule engine: ### Design Principles 1. **S...
5,469
[ { "from": "human", "value": "I often need to implement some sort of rule system that is user-editable -- the requirements are generally different enough that the same system isn't directly applicable, so I frequently run into the same problem--how do I design a rule system that\n\nis maintainable\nproperly ...
For testing purposes I have to generate a file of a certain size (to test an upload limit). What is a command to create a file of a certain size on Linux?
You can create a file of a specific size in Linux using the `dd` command. The syntax is as follows: ```bash dd if=/dev/zero of=filename bs=1M count=size_in_MB ``` Here’s how it works: - `if=/dev/zero` specifies the input file, which is a special file that produces an infinite stream of zeros. - `of=filename` specifie...
12,089
[ { "from": "human", "value": "For testing purposes I have to generate a file of a certain size (to test an upload limit). \nWhat is a command to create a file of a certain size on Linux?\n" }, { "from": "gpt", "value": "You can create a file of a specific size in Linux using the `dd` command. Th...
I'm getting a ConnectException: Connection timed out with some frequency from my code. The URL I am trying to hit is up. The same code works for some users, but not others. It seems like once one user starts to get this exception they continue to get the exception. Here is the stack trace: java.net.ConnectException:...
The `java.net.ConnectException: Connection timed out` indicates that your application is unable to establish a connection to the specified URL within the allowed time limit. Since you've mentioned that the same code works for some users and not others, there are several potential reasons for this behavior. Here are som...
5,260
[ { "from": "human", "value": "I'm getting a ConnectException: Connection timed out with some frequency from my code. The URL I am trying to hit is up. The same code works for some users, but not others. It seems like once one user starts to get this exception they continue to get the exception.\nHere is t...
I'm new to PHP and I'm confused seeing some examples calling a function with a @ prefix like @mysql_ping(). What is it for? Googling / searching is not much of a help since @ gets discarded and 'alias' is not good enough keyword.
In PHP, the `@` symbol is known as the error control operator. It is used to suppress error messages that would normally be outputted by the PHP interpreter. When you place `@` before a function call (like `@mysql_ping()`), any errors that are generated during the execution of that function will not be displayed. Inste...
11,512
[ { "from": "human", "value": "I'm new to PHP and I'm confused seeing some examples calling a function with a @ prefix like @mysql_ping().\nWhat is it for? Googling / searching is not much of a help since @ gets discarded and 'alias' is not good enough keyword.\n" }, { "from": "gpt", "value": "In ...
How can I determine if a string is an IP address? Either IPv4 or IPv6? What is the least and most number of characters? I assume this would be a regex answer.
To determine if a string is a valid IP address (either IPv4 or IPv6), you can indeed use regular expressions (regex). Below are the regex patterns for matching IPv4 and IPv6 addresses, along with details about their lengths. ### IPv4 Regex Pattern An IPv4 address consists of four decimal numbers (0-255) separated by d...
2,591
[ { "from": "human", "value": "How can I determine if a string is an IP address? Either IPv4 or IPv6?\nWhat is the least and most number of characters?\nI assume this would be a regex answer.\n" }, { "from": "gpt", "value": "To determine if a string is a valid IP address (either IPv4 or IPv6), you...
I have the vmware server with this error, anyone knows how to fix it?VMware Server Error http://soporte.cardinalsystems.com.ar/errorvmwareserver.jpg
I cannot view the image directly, but I can provide some general troubleshooting steps for common VMware Server errors. Below are some potential solutions based on typical issues users encounter: ### General Troubleshooting Steps: 1. **Check VMware Services**: Ensure that all necessary VMware services are running. On...
11,917
[ { "from": "human", "value": "I have the vmware server with this error, anyone knows how to fix it?VMware Server Error http://soporte.cardinalsystems.com.ar/errorvmwareserver.jpg\n" }, { "from": "gpt", "value": "I cannot view the image directly, but I can provide some general troubleshooting step...
I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer?
To determine whether User Account Control (UAC) is enabled on a Windows Vista or later system, you can check the value of the UAC-related registry key or utilize system functions in your application. Below are two common approaches: using the Windows Registry and using a system call. ### Method 1: Checking the Registr...
9,062
[ { "from": "human", "value": "I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer?\n" }, { "from": "gpt", "value": "To determine whether User Account Control (UAC) is enabled on a Windo...
We've got some in-house applications built in MFC, with OpenGL drawing routines. They all use the same code to draw on the screen and either print the screen or save it to a JPEG file. Everything's been working fine in Windows XP, and I need to find a way to make them work on Vista. In three of our applications, ever...
It sounds like you're dealing with some tricky issues related to MFC and OpenGL on different versions of Windows. The behavior you've described, where one MFC Multiple Document Interface (MDI) application works differently from Single Document Interface (SDI) applications, can stem from several factors. Let's go throug...
5,872
[ { "from": "human", "value": "We've got some in-house applications built in MFC, with OpenGL drawing routines. They all use the same code to draw on the screen and either print the screen or save it to a JPEG file. Everything's been working fine in Windows XP, and I need to find a way to make them work on ...
My code takes an interface as input but only excercises a couple of the interface's methods (often, just getters). When testing the code, I'd love to define an anonymous inner class that returns the test data. But what do I do about all the other methods that the interface requires? I could use my IDE to auto-generate...
If you want to create an anonymous inner class for an interface but only implement a few methods (while stubbing out the others), you can provide simple implementations for the methods you don't care about using either empty bodies or default return values. Here's how you can do this without being overly verbose: ##...
9,812
[ { "from": "human", "value": "My code takes an interface as input but only excercises a couple of the interface's methods (often, just getters).\nWhen testing the code, I'd love to define an anonymous inner class that returns the test data. But what do I do about all the other methods that the interface req...
E.g. the Soundex algorithm is optimized for English. Is there a more universal algorithm that would apply across large families of languages?
Yes, while the Soundex algorithm is indeed optimized for English, there are several other phonetic algorithms that are designed to work across a wider variety of languages. Here are a few notable examples: 1. **Metaphone and Double Metaphone**: Developed as a more advanced alternative to Soundex, the Metaphone algorit...
10,657
[ { "from": "human", "value": "E.g. the Soundex algorithm is optimized for English. Is there a more universal algorithm that would apply across large families of languages?\n" }, { "from": "gpt", "value": "Yes, while the Soundex algorithm is indeed optimized for English, there are several other p...
Running a rails site right now using SQLite3. About once every 500 requests or so, I get a ActiveRecord::StatementInvalid (SQLite3::BusyException: database is locked:... What's the way to fix this that would be minimally invasive to my code? I'm using SQLLite at the moment because you can store the DB in source control...
The `SQLite3::BusyException: database is locked` error typically arises from concurrent write operations, which SQLite isn't well-equipped to handle. Although switching to MySQL is a good long-term solution, there are some minimally invasive approaches you can try to alleviate this issue with SQLite in the interim. ##...
4,830
[ { "from": "human", "value": "Running a rails site right now using SQLite3.\nAbout once every 500 requests or so, I get a\nActiveRecord::StatementInvalid (SQLite3::BusyException: database is locked:...\nWhat's the way to fix this that would be minimally invasive to my code?\nI'm using SQLLite at the moment b...
Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser. I've considered Eclipse, but it seems to bloated and unfriendly for quick pr...
If you're looking for a lightweight and user-friendly environment for Java development on Ubuntu, there are several tools and IDEs you can consider that strike a balance between functionality and performance. Here are some recommendations: 1. **IntelliJ IDEA Community Edition**: - IntelliJ IDEA is a powerful IDE wi...
8,297
[ { "from": "human", "value": "Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser. \nI've considered Eclipse, but it se...
Has anyone got Sys::Syslog to work on Solaris? (I'm running Sys::Syslog 0.05 on Perl v5.8.4 on SunOS 5.10 on SPARC). Here's what doesn't work for me: openlog "myprog", "pid", "user" or die; syslog "crit", "%s", "Test from $0" or die; closelog() or warn "Can't close: $!"; system "tail /var/adm/messages"; Whatever I d...
It looks like you're facing issues with the `Sys::Syslog` Perl module on Solaris. The `closelog()` function returning an error could indicate that the logging is not correctly initialized or that there is an issue with how the syslog configuration is set up on your Solaris system. Here are a few suggestions to troubl...
6,357
[ { "from": "human", "value": "Has anyone got Sys::Syslog to work on Solaris? (I'm running Sys::Syslog 0.05 on Perl v5.8.4 on SunOS 5.10 on SPARC). Here's what doesn't work for me:\nopenlog \"myprog\", \"pid\", \"user\" or die;\nsyslog \"crit\", \"%s\", \"Test from $0\" or die;\ncloselog() or warn \"Can't c...
We currently have a company email server with Exchange, and a bulk email processing server that is using IIS SMTP. We are upgrading to a 3rd party MTA (zrinity xms) for bulk sending. I need to be able to keep sending the messages already queued for IIS when we switch to the 3rd party sofware. Can I simply move the IIS ...
Migrating queued emails from IIS SMTP to a different mail transfer agent (MTA) like Zrinity XMS (or any other MTA) isn't as straightforward as moving the queue files directly from one server to another. SMTP servers typically use specific formats for their queues, and transferring queue files between different MTAs can...
11,134
[ { "from": "human", "value": "We currently have a company email server with Exchange, and a bulk email processing server that is using IIS SMTP. We are upgrading to a 3rd party MTA (zrinity xms) for bulk sending. I need to be able to keep sending the messages already queued for IIS when we switch to the 3rd ...
I just installed 'Visual C# 2008 Express Edition' and 'Visual Web Developer 2008 Express Edition' on my Vista machine. Previously I have been running these in Win XP. When launching the software, starting a new project and trying to build it I get warnings like "The referenced component 'System' could not be found."; o...
The issue you're encountering with "The referenced component 'System' could not be found" in Visual C# 2008 Express Edition and Visual Web Developer 2008 Express Edition on your Vista machine is often related to problems with the .NET Framework installation or its configurations. Here are several steps you can take to ...
9,741
[ { "from": "human", "value": "I just installed 'Visual C# 2008 Express Edition' and 'Visual Web Developer 2008 Express Edition' on my Vista machine. Previously I have been running these in Win XP. When launching the software, starting a new project and trying to build it I get warnings like \"The referenced ...
In XNA, how do I load in a texture or mesh from a file without using the content pipeline?
In XNA, while the Content Pipeline is the most common way to load textures and meshes, you can also load them directly from files using the `Texture2D` and `Model` classes. Below are the steps for each type. ### Loading a Texture from a File You can load a texture directly from a file using `Texture2D.FromFile`. Here'...
9,074
[ { "from": "human", "value": "In XNA, how do I load in a texture or mesh from a file without using the content pipeline?\n" }, { "from": "gpt", "value": "In XNA, while the Content Pipeline is the most common way to load textures and meshes, you can also load them directly from files using the `Te...
How do I read text from the (windows) clipboard with python?
To read text from the clipboard in Python on a Windows system, you can use the `pyperclip` library, which is a simple and cross-platform way to handle clipboard operations. Here’s how to do it: 1. **Install the `pyperclip` library**: You can install it using pip if you haven't already. ```bash pip install pyper...
11,280
[ { "from": "human", "value": "How do I read text from the (windows) clipboard with python?\n" }, { "from": "gpt", "value": "To read text from the clipboard in Python on a Windows system, you can use the `pyperclip` library, which is a simple and cross-platform way to handle clipboard operations. ...
Has anyone used Rhino igloo in a non-trivial project? I am curious if it's worth, what are its drawbacks, does it enhance testability a lot, is it easy to use. How would you compare it to a pure MVC framework (ASP.NET MVC)? Please share the experience.
Rhino IGloo is an interesting framework for building applications in a way that supports inversion of control (IoC) and dependency injection, particularly in the context of ASP.NET applications. Below are some insights based on experiences shared by developers who have used Rhino IGloo in non-trivial projects. ### Adv...
6,248
[ { "from": "human", "value": "Has anyone used Rhino igloo in a non-trivial project? I am curious if it's worth, what are its drawbacks, does it enhance testability a lot, is it easy to use. How would you compare it to a pure MVC framework (ASP.NET MVC)? Please share the experience.\n" }, { "from": "g...
Based on a simple test I ran, I don't think it's possible to put an inline <style> tag into an ASP.NET server control. The style did not end up rendering to the output HTML. Even if it was possible, I'm sure it is bad practice to do this. Is it possible to do this? I can see it being useful for quick prototypes that...
In ASP.NET Web Forms, it is indeed possible to add inline styles to server controls, but doing so using a `<style>` tag directly within the server control is not the typical way. Instead, you can set styles directly on the control using the `Attributes` collection or the `Style` property. Here’s how you can apply inl...
8,421
[ { "from": "human", "value": "Based on a simple test I ran, I don't think it's possible to put an inline <style> tag into an ASP.NET server control. The style did not end up rendering to the output HTML. Even if it was possible, I'm sure it is bad practice to do this.\nIs it possible to do this? I can see...
I currently maintain 3 websites all revolving around the same concept. 2 of them are WinForms applications where the website gives a few basic details, and download links. The third is a web application to query data. I also have a forum (SMF/TinyPortal) that has been serving as a tech support/news hub for the three si...
When consolidating multiple websites and community forums into a single platform, it's essential to choose a Content Management System (CMS) that meets your specific needs. Here’s a comparison of the platforms you mentioned, along with some other considerations, focusing on their features, expandability, customization,...
7,602
[ { "from": "human", "value": "I currently maintain 3 websites all revolving around the same concept. 2 of them are WinForms applications where the website gives a few basic details, and download links. The third is a web application to query data. I also have a forum (SMF/TinyPortal) that has been serving as...
I know I can edit each individual DTS package and save it as a Visual Basic script, but with hundreds of packages on the server, that will take forever. How can I script them all at once? I'd like to be able to create one file per package so that I can check them into source control, search them to see which one refe...
To export all DTS packages from SQL Server and save each one as a Visual Basic script in individual files, you can use a script in PowerShell or VBScript, depending on your environment. Since you're working with potentially hundreds of packages, automating this process will save you a lot of time. ### PowerShell Scrip...
7,888
[ { "from": "human", "value": "I know I can edit each individual DTS package and save it as a Visual Basic script, but with hundreds of packages on the server, that will take forever. How can I script them all at once? I'd like to be able to create one file per package so that I can check them into source c...
I am looking for a little bit of JQuery or JS that allows me to produce a horizontally scrolling "news ticker" list. The produced HTML needs to be standards compliant as well. I have tried liScroll but this has a habit of breaking (some content ends up on a second line at the start of the scroll), especially with longe...
Creating a horizontally scrolling news ticker using jQuery or plain JavaScript can be accomplished in a standards-compliant way. Here’s a simple implementation using jQuery with smooth continuous scrolling that avoids wrapping issues, along with the necessary HTML and CSS. ### HTML ```html <!DOCTYPE html> <html lang=...
5,343
[ { "from": "human", "value": "I am looking for a little bit of JQuery or JS that allows me to produce a horizontally scrolling \"news ticker\" list.\nThe produced HTML needs to be standards compliant as well.\nI have tried liScroll but this has a habit of breaking (some content ends up on a second line at th...
I've been working through Practical Common Lisp and as an exercise decided to write a macro to determine if a number is a multiple of another number: (defmacro multp (value factor) `(= (rem ,value ,factor) 0)) so that : (multp 40 10) evaluates to true whilst (multp 40 13) does not The question is does this macro l...
Your macro definition for `multp` looks reasonable for checking if one number is a multiple of another by using the `rem` function. However, there are some considerations regarding macro usage, evaluation, and potential issues: ### 1. **Macro Evaluation Leakage** Macros in Lisp perform syntactic transformations at com...
10,858
[ { "from": "human", "value": "I've been working through Practical Common Lisp and as an exercise decided to write a macro to determine if a number is a multiple of another number:\n(defmacro multp (value factor)\n `(= (rem ,value ,factor) 0))\nso that :\n(multp 40 10)\nevaluates to true whilst\n(multp 40 ...
An obscure puzzle, but it's driving me absolutely nuts: I'm creating a custom Information Management Policy in MOSS. I've implemented IPolicyFeature, and my policy feature happily registers itself by configuring a new SPItemEventReceiver. All new items in my library fire the events as they should, and it all works fine...
It sounds like you've already made significant progress in diagnosing the issue with your custom Information Management Policy implementation in MOSS. The problem you encountered, where modifying an SPListItem during the iteration caused your `ProcessListItem` method to stop processing after the first item, is a common...
10,865
[ { "from": "human", "value": "An obscure puzzle, but it's driving me absolutely nuts:\nI'm creating a custom Information Management Policy in MOSS. I've implemented IPolicyFeature, and my policy feature happily registers itself by configuring a new SPItemEventReceiver. All new items in my library fire the ev...
Grails scaffolding defaults to 10 rows per page. I would like to increase that number without generating the views and changing the 10 in every file. Where do I change the default?
In a Grails application, you can change the default pagination size for scaffolding without modifying each generated view file individually by updating the default configuration in `grails-app/conf/application.yml` or `grails-app/conf/application.groovy` file, depending on your Grails version and how you manage your co...
9,462
[ { "from": "human", "value": "Grails scaffolding defaults to 10 rows per page. I would like to increase that number without generating the views and changing the 10 in every file. Where do I change the default?\n" }, { "from": "gpt", "value": "In a Grails application, you can change the default...
Ajax, Flex and Silverlight are a few ways to make more interactive web applications. What kinds of factors would you consider when deciding which to use for a new web application? Does any one of them offer better cross-platform compatibility, performance, developer tools or community support?
When deciding between Ajax, Flex, and Silverlight for a new web application, several factors should be considered: ### 1. **Cross-Platform Compatibility** - **Ajax**: Being a combination of technologies (HTML, CSS, JavaScript), Ajax is inherently cross-platform and works in any modern web browser. It is the most wi...
7,513
[ { "from": "human", "value": "Ajax, Flex and Silverlight are a few ways to make more interactive web applications. What kinds of factors would you consider when deciding which to use for a new web application? \nDoes any one of them offer better cross-platform compatibility, performance, developer tools or...
I used to work in a place where a common practice was to use Pair Programming. I remember how many small things we could learn from each other when working together on the code. Picking up new shortcuts, code snippets etc. with time significantly improved our efficiency of writing code. Since I started working with SQL...
Absolutely! Here are some specific tips and shortcuts to help you efficiently use SQL Server Management Studio (SSMS) for writing T-SQL code, particularly in the 2005/2008 versions: ### 1. Keyboard Shortcuts Familiarizing yourself with keyboard shortcuts can significantly speed up your coding process. Here are a few k...
11,039
[ { "from": "human", "value": "I used to work in a place where a common practice was to use Pair Programming. I remember how many small things we could learn from each other when working together on the code. Picking up new shortcuts, code snippets etc. with time significantly improved our efficiency of writi...
What is the best way to track changes in a database table? Imagine you got an application in which users (in the context of the application not DB users ) are able to change data which are store in some database table. What's the best way to track a history of all changes, so that you can show which user at what time c...
Tracking changes in a database table to maintain a history of modifications can be accomplished in various ways, depending on your specific requirements, the database system you are using, and the complexity of the data. Below are several effective methods to track changes, along with their pros and cons: ### 1. **Cha...
5,984
[ { "from": "human", "value": "What is the best way to track changes in a database table?\nImagine you got an application in which users (in the context of the application not DB users ) are able to change data which are store in some database table. What's the best way to track a history of all changes, so t...
I'm writing the memory manager for an application, as part of a team of twenty-odd coders. We're running out of memory quota and we need to be able to see what's going on, since we only appear to be using about 700Mb. I need to be able to report where it's all going - fragmentation etc. Any ideas?
Certainly! Memory management and tracking memory usage is a crucial aspect of application development, especially in environments with limited memory quotas. Here are several approaches and tools that you can implement to help identify where memory is being allocated, where fragmentation occurs, and how to optimize usa...
9,699
[ { "from": "human", "value": "I'm writing the memory manager for an application, as part of a team of twenty-odd coders. We're running out of memory quota and we need to be able to see what's going on, since we only appear to be using about 700Mb. I need to be able to report where it's all going - fragmenta...
I am a novice programmer who is trying to teach myself to code, specifically in C#. I've taken on a project from a friend of mine and I am not sure what I need to know to get the project done. I suppose the issue is I don't know what I need to know to even get the project started. I do have many of the basics of object...
It's great that you're taking the initiative to learn C# and tackle a project! It can be overwhelming when you're not sure where to begin, but here are some steps and resources that can help you get started and improve your skills: ### 1. Familiarize Yourself with C# Syntax and Features To get comfortable with C#, you...
5,825
[ { "from": "human", "value": "I am a novice programmer who is trying to teach myself to code, specifically in C#. I've taken on a project from a friend of mine and I am not sure what I need to know to get the project done. I suppose the issue is I don't know what I need to know to even get the project starte...
For one and a half years, I have been keeping my eyes on the git community in hopes of making the switch away from SVN. One particular issue holding me back is the inability to lock binary files. Throughout the past year I have yet to see developments on this issue. I understand that locking files goes against the fu...
Your concerns about handling binary files in Git are quite common, especially for teams transitioning from systems like SVN that have built-in support for file locking. While Git's distributed nature indeed complicates the ability to implement a locking mechanism, there are several strategies and tools you can consider...
10,434
[ { "from": "human", "value": "For one and a half years, I have been keeping my eyes on the git community in hopes of making the switch away from SVN. One particular issue holding me back is the inability to lock binary files. Throughout the past year I have yet to see developments on this issue. I understa...
In PostgreSQL, I can do something like this: ALTER SEQUENCE serial RESTART WITH 0; Is there an Oracle equivalent?
Yes, in Oracle, you can achieve similar functionality by altering a sequence to restart it from a specific value. However, Oracle does not have a direct equivalent of the `RESTART WITH` clause like PostgreSQL. Instead, you would typically drop and recreate the sequence or use a workaround to set it to a new starting va...
11,562
[ { "from": "human", "value": "In PostgreSQL, I can do something like this:\nALTER SEQUENCE serial RESTART WITH 0;\n\nIs there an Oracle equivalent?\n" }, { "from": "gpt", "value": "Yes, in Oracle, you can achieve similar functionality by altering a sequence to restart it from a specific value. Ho...
We are struggling to configure our web app to be able to connect with web services via Spring WS. We have tried to use the example from the documentation of client-side Spring-WS, but we end up with a WebServiceTransportException. The XML config looks like this: <bean id="webServiceTemplate" class="org.springframework....
To resolve your issue, we need to ensure that the Spring XML configuration for your `WebServiceTemplate` correctly configures the underlying HTTP client and sets the necessary credentials. In your Java configuration, you are configuring the `HttpClient` and its `Credentials`, but in the XML configuration, the `CommonsH...
9,013
[ { "from": "human", "value": "We are struggling to configure our web app to be able to connect with web services via Spring WS. We have tried to use the example from the documentation of client-side Spring-WS, but we end up with a WebServiceTransportException. The XML config looks like this:\n<bean id=\"webS...
I need to cache a single page. I've used ActionController's caches_page for this. But now, I'd like to expire AND regenerate it once in every 10 minutes. What are my options? later: I'd like to not use any external tools for this, like cron. The important point is interval-based expiry of the cache.
To cache a page in a Ruby on Rails application and have it expire and regenerate every 10 minutes without using external tools like cron, you can leverage Rails' built-in caching mechanisms along with a background job or a custom caching strategy using Rails' `before_action` or a similar mechanism. Here’s how you can ...
8,821
[ { "from": "human", "value": "I need to cache a single page. I've used ActionController's caches_page for this. But now, I'd like to expire AND regenerate it once in every 10 minutes. What are my options?\nlater: I'd like to not use any external tools for this, like cron. The important point is interval-base...
Anyone got a working example of using ruby to post to a presigned URL on s3
Certainly! To post a file to a presigned URL on Amazon S3 using Ruby, you can use the `aws-sdk-s3` gem to generate the presigned URL and then use `Net::HTTP` or any HTTP client to send the file to that URL. Here's a step-by-step example of how to do it: ### Step 1: Set up your environment Make sure you have the `aws...
6,138
[ { "from": "human", "value": "Anyone got a working example of using ruby to post to a presigned URL on s3\n" }, { "from": "gpt", "value": "Certainly! To post a file to a presigned URL on Amazon S3 using Ruby, you can use the `aws-sdk-s3` gem to generate the presigned URL and then use `Net::HTTP` ...
I have some template code that I would prefer to have stored in a CPP file instead of inline in the header. I know this can be done as long as you know which template types will be used. For example: .h file class foo { public: template <typename T> void do(const T& t); }; .cpp file template <typename T> voi...
What you're describing is a valid and common pattern in C++ for implementing template functions in a .cpp file while controlling instantiation and linking. This is not considered a hack; rather, it's an idiomatic approach that is widely used, and it should work with most, if not all, standard-compliant C++ compilers an...
9,189
[ { "from": "human", "value": "I have some template code that I would prefer to have stored in a CPP file instead of inline in the header. I know this can be done as long as you know which template types will be used. For example:\n.h file\nclass foo\n{\npublic:\n template <typename T>\n void do(const...
I've setup a results store and when I publish results of a load test, I can't view the published test details. From the test run section of the build report I click on the published build and when I choose View Test Results Details from the Test Runs shortcut menu I get an error that the test results details cannot be...
To successfully publish load test results to a results store and view them, several key steps need to be ensured: 1. **Configuration of Test Controller:** You mentioned that you set up a connection string in the Administer Test Controller dialog. Ensure that this connection string is correctly configured and pointing ...
9,760
[ { "from": "human", "value": "I've setup a results store and when I publish results of a load test, I can't view the published test details. \nFrom the test run section of the build report I click on the published build and when I choose View Test Results Details from the Test Runs shortcut menu I get an err...
What is the best method to transfer data from sales table to sales history table in sql server 2005. sales history table will be used for reporting.
Transferring data from a `sales` table to a `sales_history` table in SQL Server 2005 can be accomplished using several methods, but the best method will depend on the specific requirements, such as whether you want to transfer all records, a subset of records, whether you want to retain a copy in the original table, an...
8,235
[ { "from": "human", "value": "What is the best method to transfer data from sales table to sales history table in sql server 2005. sales history table will be used for reporting.\n" }, { "from": "gpt", "value": "Transferring data from a `sales` table to a `sales_history` table in SQL Server 2005 ...
My Web Application is split up in a WebGui and an WebService. The WebService is responsible for Business Logic and Database handling. From Javascript in the Browser I request data depending on a date and time that is an input from the Browser. This request gous to an .asmx Url in the WebGui and inside this function the...
The issue you're encountering is likely due to the handling of time zones on your development and test environments. Here are several factors that could contribute to this discrepancy and some potential solutions: ### Possible Causes 1. **Local Time Zone Settings**: Your development system (Windows XP) and test syste...
8,720
[ { "from": "human", "value": "My Web Application is split up in a WebGui and an WebService. The WebService is responsible for Business Logic and Database handling.\nFrom Javascript in the Browser I request data depending on a date and time that is an input from the Browser. This request gous to an .asmx Url ...
How can I get a history of uptimes for my debian box? After a reboot, I dont see an option for the uptime command to print a history of uptimes. If it matters, I would like to use these uptimes for graphing a page in php to show my webservers uptime lengths between boots. Update: Not sure if it is based on a length of...
To track the uptime history of your Debian server, you can use several methods to log and store uptime data. Since you've identified `uptimed` as a relevant tool, I can provide guidance on using it, as well as suggest an alternative script-based method. ### Method 1: Using Uptimed `uptimed` is a daemon that tracks sy...
8,341
[ { "from": "human", "value": "How can I get a history of uptimes for my debian box? After a reboot, I dont see an option for the uptime command to print a history of uptimes. If it matters, I would like to use these uptimes for graphing a page in php to show my webservers uptime lengths between boots.\nUpdat...
Word wrap is one of the must-have features in a modern text editor. How word wrap be handled? What is the best algorithm for word-wrap? If text is several million lines, how can I make word-wrap very fast? Why do I need the solution? Because my projects must draw text with various zoom level and simultaneously beautifu...
Implementing efficient word wrap in a modern text editor, especially in a constrained environment like Windows Mobile with limited processing power and memory, requires a careful approach to both the algorithm and data structures used. Here are some considerations and recommendations: ### Word Wrap Algorithm 1. **Gre...
6,145
[ { "from": "human", "value": "Word wrap is one of the must-have features in a modern text editor.\nHow word wrap be handled? What is the best algorithm for word-wrap?\nIf text is several million lines, how can I make word-wrap very fast?\nWhy do I need the solution? Because my projects must draw text with va...
Is it possible to use an attribute of a child to group a query? Post.find(:all, :include => [ :authors, :comments ], :group=>'authors.city') does not work. However, I am able to use author.city as part of the conditions.
In Active Record, when you want to group results based on an attribute from an associated model, you need to ensure that the associated model's column is properly referenced in the SQL query. The issue you're encountering is likely due to how the SQL is generated when using Active Record's `:group` option. Here’s how ...
10,374
[ { "from": "human", "value": "Is it possible to use an attribute of a child to group a query?\nPost.find(:all, :include => [ :authors, :comments ], :group=>'authors.city') \n\ndoes not work. \nHowever, I am able to use author.city as part of the conditions.\n" }, { "from": "gpt", "value": "In Act...
As per the title. For those who don't know, it's basically Ada for .Net.
It seems you are referring to the programming language "Ada" and its relation to .NET. Ada is a high-level programming language designed for large, long-lived applications, particularly in systems where safety and reliability are critical, such as in aerospace and defense. However, there isn't an exact equivalent to Ad...
11,571
[ { "from": "human", "value": "As per the title. For those who don't know, it's basically Ada for .Net.\n" }, { "from": "gpt", "value": "It seems you are referring to the programming language \"Ada\" and its relation to .NET. Ada is a high-level programming language designed for large, long-lived ...
I just wonder about an easy way to make i18n inside Smarty templates. Something like gettext() which I already use inside my PHP scripts. Any ideas?
Implementing internationalization (i18n) within Smarty templates can be achieved using a combination of the `gettext` PHP extension and custom Smarty modifiers or functions. Here’s a step-by-step guide on how to set this up: ### Step 1: Set Up Gettext 1. **Install Gettext**: Make sure you have the Gettext PHP extensi...
10,540
[ { "from": "human", "value": "I just wonder about an easy way to make i18n inside Smarty templates.\nSomething like gettext() which I already use inside my PHP scripts.\nAny ideas?\n" }, { "from": "gpt", "value": "Implementing internationalization (i18n) within Smarty templates can be achieved us...
I've been writing C / C++ code for almost twenty years, and I know Perl, Python, PHP, and some Java as well, and I'm teaching myself JavaScript. But I've never done any .NET, VB, or C# stuff. What exactly does managed code mean? Wikipedia describes it simply as Code that executes under the management of a virtual mach...
Your questions are insightful and get to the heart of some important concepts in modern software development. Let's break them down one at a time. ### 1. What is Managed Code? Managed code refers to code that runs under the control of a managed runtime environment, which handles aspects like memory management, except...
9,508
[ { "from": "human", "value": "I've been writing C / C++ code for almost twenty years, and I know Perl, Python, PHP, and some Java as well, and I'm teaching myself JavaScript. But I've never done any .NET, VB, or C# stuff. What exactly does managed code mean?\nWikipedia describes it simply as\n\nCode that exe...
I was reading a question about the Python global statement ( "Python scope" ) and I was remembering about how often I used this statement when I was a Python beginner (I used global a lot) and how, nowadays, years later, I don't use it at all, ever. I even consider it a bit "un-pythonic". Do you use this statement in P...
The use of the `global` statement in Python is often a topic of discussion among developers, especially as they gain more experience. In general, beginners may rely on `global` to modify global variables within functions, but as they become more comfortable with Python and learn about better practices, the reliance on ...
12,127
[ { "from": "human", "value": "I was reading a question about the Python global statement ( \"Python scope\" ) and I was remembering about how often I used this statement when I was a Python beginner (I used global a lot) and how, nowadays, years later, I don't use it at all, ever. I even consider it a bit \"...
Is there a quick way to find every match of a regular expression in Ruby? I've looked through the Regex object in the Ruby STL and searched on Google to no avail.
Yes, in Ruby, you can use the `scan` method on a string to find every match of a regular expression. The `scan` method returns an array of all matches found. Here's an example of how to use it: ```ruby text = "Hello world! Welcome to the world of Ruby." pattern = /world/ matches = text.scan(pattern) puts matches.ins...
11,627
[ { "from": "human", "value": "Is there a quick way to find every match of a regular expression in Ruby? I've looked through the Regex object in the Ruby STL and searched on Google to no avail.\n" }, { "from": "gpt", "value": "Yes, in Ruby, you can use the `scan` method on a string to find every m...
Is it possible to use .htaccess to process all six digit URLs by sending them to a script, but handle every other invalid URL as an error 404? For example: http://mywebsite.com/132483 would be sent to: http://mywebsite.com/scriptname.php?no=132483 but http://mywebsite.com/132483a or http://mywebsite.com/asdf would b...
Yes, you can achieve this using an `.htaccess` file by utilizing mod_rewrite. This allows you to rewrite URLs based on specific patterns and serve a script when a condition is met, while sending all other requests to a 404 error. Here's how you can set this up: 1. Make sure your server has the mod_rewrite module enab...
8,564
[ { "from": "human", "value": "Is it possible to use .htaccess to process all six digit URLs by sending them to a script, but handle every other invalid URL as an error 404?\nFor example:\nhttp://mywebsite.com/132483\n\nwould be sent to:\nhttp://mywebsite.com/scriptname.php?no=132483\n\nbut\nhttp://mywebsite....