instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
In my application I have TextBox in a FormView bound to a LinqDataSource like so: <asp:TextBox ID="MyTextBox" runat="server" Text='<%# Bind("MyValue") %>' AutoPostBack="True" ontextchanged="MyTextBox_TextChanged" /> protected void MyTextBox_TextChanged(object sender, EventArgs e) { MyFo...
To handle invalid decimal input gracefully and convert them to `null` instead of throwing an exception, you can implement a custom parsing logic in your `MyTextBox_TextChanged` event handler. You can check if the value entered in the `TextBox` is a valid decimal or not. If it's not valid, you can manually set the corre...
2,646
[ { "from": "human", "value": "In my application I have TextBox in a FormView bound to a LinqDataSource like so:\n<asp:TextBox ID=\"MyTextBox\" runat=\"server\" \n Text='<%# Bind(\"MyValue\") %>' AutoPostBack=\"True\" \n ontextchanged=\"MyTextBox_TextChanged\" />\n\nprotected void MyTe...
User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am wondering when the best time to sanitize input is. For example, do you blindly store user input and then sanitize it whenever it is accessed/used, or do you sanitize the input immediately and then store this "cleaned" version? ...
When it comes to handling user input in a secure and efficient way, the timing and method of sanitization are critical. Let's break down the two approaches you mentioned and discuss other potential strategies. ### 1. Immediate Sanitization (Option 1) - **Sanitize and Store**: In this method, you sanitize the input as ...
2,295
[ { "from": "human", "value": "User equals untrustworthy. Never trust untrustworthy user's input. I get that. However, I am wondering when the best time to sanitize input is. For example, do you blindly store user input and then sanitize it whenever it is accessed/used, or do you sanitize the input immediatel...
In python, you can have a function return multiple values. Here's a contrived example: def divide(x, y): quotient = x/y remainder = x % y return quotient, remainder (q, r) = divide(22, 7) This seems very useful, but it looks like it can also be abused ("Well..function X already computes what we need as...
Returning multiple values from a function in Python can indeed be very useful, but it's essential to strike a balance between convenience and clarity. Here are some guidelines on when to return multiple values and when to define a different method: ### When to Return Multiple Values: 1. **Logical Grouping**: If the m...
3,156
[ { "from": "human", "value": "In python, you can have a function return multiple values. Here's a contrived example:\ndef divide(x, y):\n quotient = x/y\n remainder = x % y\n return quotient, remainder \n\n(q, r) = divide(22, 7)\n\nThis seems very useful, but it looks like it can also be abused (\...
I've been using PostgreSQL a little bit lately, and one of the things that I think is cool is that you can use languages other than SQL for scripting functions and whatnot. But when is this actually useful? For example, the documentation says that the main use for PL/Perl is that it's pretty good at text manipulation....
Using procedural languages like PL/Perl, PL/Python, and even PL/LOLCODE in PostgreSQL can provide distinct advantages for certain tasks. Here are some scenarios where using these languages can be particularly useful: ### When to Use Procedural Languages in PostgreSQL 1. **Complex Logic Inside the Database**: - If ...
603
[ { "from": "human", "value": "I've been using PostgreSQL a little bit lately, and one of the things that I think is cool is that you can use languages other than SQL for scripting functions and whatnot. But when is this actually useful?\nFor example, the documentation says that the main use for PL/Perl is t...
I always run into the same problem when creating web pages. When I add a font that is larger then about 16-18px it looks terrible. Its jagged, and pixelated. I have tried using different fonts and weights, however I haven't had much luck there. Note: Its only in windows that it is like this. Mainly in Opera and FF als...
The issue you're experiencing with larger font sizes appearing jagged or pixelated in Windows browsers is relatively common, especially in certain rendering environments. Here are several approaches to improve font rendering on your web pages: ### 1. **Font Smoothing (CSS)** Add the following CSS rules to enable font...
1,814
[ { "from": "human", "value": "I always run into the same problem when creating web pages. When I add a font that is larger then about 16-18px it looks terrible. Its jagged, and pixelated. I have tried using different fonts and weights, however I haven't had much luck there. \nNote: Its only in windows that i...
When is it appropriate to use an unsigned variable over a signed one? What about in a for loop? I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. for (unsigned int i = 0; i < someThing.length(); i++) { SomeThing var = someThing.at(i); // You get the idea....
The use of signed versus unsigned integers can depend on the specific context of your application, as well as the type of operations you intend to perform on the variables. Here are some considerations for when it might be appropriate to use an unsigned variable over a signed one, and specifically in the context of a `...
2,273
[ { "from": "human", "value": "When is it appropriate to use an unsigned variable over a signed one? What about in a for loop?\nI hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. \nfor (unsigned int i = 0; i < someThing.length(); i++) { \n SomeThing var =...
I have a self-referential Role table that represents a tree structure ID [INT] AUTO INCREMENT Name [VARCHAR] ParentID [INT] I am using an ADO.NET DataTable and DataAdapter to load and save values to this table. This works if I only create children of existing rows. If I make a child row, then make a child of that chi...
When you're working with self-referential tables in a DataTable and you want to maintain the parent-child relationship while allowing the ID values to propagate correctly, you have to ensure a couple of things: 1. **Data Relation and Hierarchy**: You seem to have set up the data relation correctly. However, after addi...
2,865
[ { "from": "human", "value": "I have a self-referential Role table that represents a tree structure \nID [INT] AUTO INCREMENT\nName [VARCHAR]\nParentID [INT]\n\nI am using an ADO.NET DataTable and DataAdapter to load and save values to this table. This works if I only create children of existing rows. If I m...
How can you reliably and dynamically load a JavaScript file? This will can be used to implement a module or component that when 'initialized' the component will dynamically load all needed JavaScript library scripts on demand. The client that uses the component isn't required to load all the library script files (and ...
To reliably and dynamically load JavaScript files, you can create a function that appends script elements to the document. This approach can be useful for modular components that only load the necessary libraries as needed. Here's a basic example of how you could implement this: ### Dynamic Script Loading Example ```...
900
[ { "from": "human", "value": "How can you reliably and dynamically load a JavaScript file? This will can be used to implement a module or component that when 'initialized' the component will dynamically load all needed JavaScript library scripts on demand.\nThe client that uses the component isn't required ...
We currently maintain a suit of MFC applications that are fairly well designed, however the user interface is beginning to look tired and a lot of the code is in need quite a bit of refactoring to tidy up some duplication and/or performance problems. We make use of quite a few custom controls that handle all their own...
Migrating from MFC to Qt can be a beneficial endeavor, especially given the advantages that Qt offers in terms of modern UI design and cross-platform compatibility. Here are some considerations and strategies for transitioning from MFC to Qt: ### Assessing Current Applications 1. **Identify Pain Points**: Before divi...
538
[ { "from": "human", "value": "We currently maintain a suit of MFC applications that are fairly well designed, however the user interface is beginning to look tired and a lot of the code is in need quite a bit of refactoring to tidy up some duplication and/or performance problems. We make use of quite a few ...
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button look "pressed"? Imagine this button is an on/off switch. ToolStripButton has the Checked property, but the regular Button does not.
In WinForms, while the regular `Button` control does not have a `Checked` property like `ToolStripButton`, you can achieve the appearance of a pressed button (similar to a toggle or on/off switch) by changing its visual state based on user interaction. Here’s how you can do that: 1. Use a `Button` control on your for...
1,591
[ { "from": "human", "value": "Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button look \"pressed\"?\nImagine this button is an on/off switch. \nToolStripButton has the Checked property, but the regular Button does not.\n" }, { "from": "gpt", "value": "In WinForms, while the regu...
I am creating a program that will be installed using the .net installer project. The program writes to settings files to its directory in the Program Files dir. It believe there are some active directory settings that will prevent the application from righting to that directory if a limited user is running the program....
When developing a .NET application that needs to write settings files in the Program Files directory, you will typically run into permission issues, especially if the application is run by limited users. Here are some approaches you can consider to handle this situation: ### 1. Use the Local Application Data Folder In...
1,304
[ { "from": "human", "value": "I am creating a program that will be installed using the .net installer project. The program writes to settings files to its directory in the Program Files dir. It believe there are some active directory settings that will prevent the application from righting to that directory ...
I played with one of the early beta versions of PowerShell V1, but haven't used it since it went "gold". What is the best way to get started using PowerShell? Which version of PowerShell should I be using (V1.0 vs 2.0 CTP's)? What are you using PowerShell for? Are there any tools that make using PowerShell easier (that...
Getting started with PowerShell can be an exciting journey, especially if you're transitioning from a beta version to a more stable release. Here are some suggestions to help you get up to speed: ### PowerShell Version - **PowerShell 2.0**: If you're just starting out, I highly recommend using PowerShell 2.0 or later ...
464
[ { "from": "human", "value": "I played with one of the early beta versions of PowerShell V1, but haven't used it since it went \"gold\". What is the best way to get started using PowerShell?\nWhich version of PowerShell should I be using (V1.0 vs 2.0 CTP's)? What are you using PowerShell for? Are there any t...
First of all, I know how to build a Java application. But I have always been puzzled about where to put my classes. There are proponents for organizing the packages in a strictly domain oriented fashion, others separate by tier. I myself have always had problems with naming, placing So, Where do you put your domai...
Organizing a Java application into packages can be a challenging task, especially when trying to balance domain-driven design principles with practical software architecture. Here's a structured way to think about package organization, addressing your questions in the process. ### 1. Package Organization: Domain vs. L...
133
[ { "from": "human", "value": "First of all, I know how to build a Java application. But I have always been puzzled about where to put my classes. There are proponents for organizing the packages in a strictly domain oriented fashion, others separate by tier.\nI myself have always had problems with \n\nnaming...
I'm looking at adding scripting functionality to an existing codebase and am weighing up the pros/cons of various packages. Lua is probably the most obvious choice, but I was wondering if people have any other suggestions based on their experience. Scripts will be triggered upon certain events and may stay resident for...
There are several scripting languages and libraries you could consider for your C/C++ codebase that meet your requirements. Here’s an overview of some popular options along with their pros and cons: ### 1. Lua **Pros:** - Lightweight and fast. - Easy to embed and extend with C/C++. - Simple API for binding functions. ...
2,477
[ { "from": "human", "value": "I'm looking at adding scripting functionality to an existing codebase and am weighing up the pros/cons of various packages. Lua is probably the most obvious choice, but I was wondering if people have any other suggestions based on their experience.\nScripts will be triggered upo...
This is how I wanted to do it which would work in PHP 5.3.0+ <?php class MyClass { const CONSTANT = 'Const var'; } $classname = 'MyClass'; echo $classname::CONSTANT; // As of PHP 5.3.0 ?> But I'm restricted to using PHP 5.2.6. Can anyone think of a simple way to simulate this behav...
In PHP 5.2.6, the ability to use the `::` constant access syntax on class names stored in a variable does not exist. However, you can achieve similar functionality by using the `get_class` function or using a static method to return the constant value. Here's one way to simulate this behavior: ### Using a Static Metho...
3,150
[ { "from": "human", "value": "This is how I wanted to do it which would work in PHP 5.3.0+\n<?php\n class MyClass\n {\n const CONSTANT = 'Const var'; \n }\n\n $classname = 'MyClass';\n echo $classname::CONSTANT; // As of PHP 5.3.0\n?>\n\nBut I'm restricted to using PHP 5.2.6. Can...
What are the differences between these two, and which one should I use? string s = "Hello world!"; String s = "Hello world!";
The primary difference between `string` and `String` in C# is their casing and what they represent. Here’s a breakdown of the differences: 1. **`string` vs. `String`**: - `string` is an alias in C# for `System.String`. It is a keyword in the language and is used in a more idiomatic way. - `String` is the actual ...
2,109
[ { "from": "human", "value": "What are the differences between these two, and which one should I use?\nstring s = \"Hello world!\";\nString s = \"Hello world!\";\n\n" }, { "from": "gpt", "value": "The primary difference between `string` and `String` in C# is their casing and what they represent. ...
Here is my code, which takes two version identifiers in the form "1, 5, 0, 4" or "1.5.0.4" and determines which is the newer version. Suggestions or improvements, please! /// <summary> /// Compares two specified version strings and returns an integer that /// indicates their relationship to one another in ...
Your code for comparing version identifiers is quite solid, but there are some areas where you can make improvements. Here are some suggestions: 1. **Dynamic Version Length**: Rather than assuming that both version strings will always have four components, your method should be able to handle version strings of varyin...
997
[ { "from": "human", "value": "Here is my code, which takes two version identifiers in the form \"1, 5, 0, 4\" or \"1.5.0.4\" and determines which is the newer version.\nSuggestions or improvements, please!\n /// <summary>\n /// Compares two specified version strings and returns an integer that \n //...
Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts on a postcard please.
Catching general exceptions (like `System.Exception` in C#) can lead to a number of issues, and it's generally considered a bad practice for several reasons: 1. **Hiding Bugs**: If you catch all exceptions, you might inadvertently swallow exceptions that indicate bugs in your code. This makes debugging difficult becau...
2,861
[ { "from": "human", "value": "Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts on a postcard please.\n" }, { "from": "gpt", "value": "Catching ge...
I have a quad core machine and would like to write some code to parse a text file that takes advantage of all four cores. The text file basically contains one record per line. Multithreading isn't my forte so I'm wondering if anyone could give me some patterns that I might be able to use to parse the file in an optimal...
You're correct that multithreading can introduce complexity, especially when it comes to coordinating work between threads. Given your scenario, you want to process a large text file where each line is a record, and you want to efficiently utilize all four cores of your quad-core machine. Below are a couple of approach...
1,894
[ { "from": "human", "value": "I have a quad core machine and would like to write some code to parse a text file that takes advantage of all four cores. The text file basically contains one record per line.\nMultithreading isn't my forte so I'm wondering if anyone could give me some patterns that I might be a...
I have a custom SharePoint application page deployed to the _layouts folder. It's a custom "new form" for a custom content type. During my interactions with this page, I will need to add an item to my list. When the page first loads, I can use SPContext.Current.List to see the current list I'm working with. But aft...
Yes, this behavior is expected in the context of SharePoint 2007 and your custom application page. When the page first loads, `SPContext.Current.List` contains the reference to the current list, but during a postback, the context can change depending on how the page is processed. This is common in SharePoint, especiall...
2,848
[ { "from": "human", "value": "I have a custom SharePoint application page deployed to the _layouts folder. It's a custom \"new form\" for a custom content type. During my interactions with this page, I will need to add an item to my list. When the page first loads, I can use SPContext.Current.List to see ...
Older versions of the .Net Framework used to install "Microsoft .NET Framework v1.0 / v1.1 / v2.0 Configuration" in the Control Panel, under Administrative Tools. I just noticed that there isn't a v3.0 or v3.5 version of this. Is this functionality now hiding somewhere else, or do I have to use the command-line tools i...
In the later versions of the .NET Framework, specifically starting from version 3.0 and onward, Microsoft shifted away from having a separate configuration tool in the Control Panel under Administrative Tools. Instead, the configuration of these versions is integrated into other tools, and some aspects have been simpli...
2,798
[ { "from": "human", "value": "Older versions of the .Net Framework used to install \"Microsoft .NET Framework v1.0 / v1.1 / v2.0 Configuration\" in the Control Panel, under Administrative Tools. I just noticed that there isn't a v3.0 or v3.5 version of this. Is this functionality now hiding somewhere else, o...
I'm looking for a key/value pair object that I can include in a web service. I tried using .NET's System.Collections.Generic.KeyValuePair<> class, but it does not properly serialize in a web service. In a web service, the Key and Value properties are not serialized, making this class useless, unless someone knows a way...
If you are having trouble serializing `KeyValuePair<TKey, TValue>` in a web service, there are a couple of alternative approaches you can consider. Since `KeyValuePair<>` does not serialize well, you might want to define your own simple generic class for serialization purposes. ### Option 1: Define a Custom Generic Cl...
3,346
[ { "from": "human", "value": "I'm looking for a key/value pair object that I can include in a web service.\nI tried using .NET's System.Collections.Generic.KeyValuePair<> class, but it does not properly serialize in a web service. In a web service, the Key and Value properties are not serialized, making this...
I'm on laptop (Ubuntu) with a network that use HTTP proxy (only http connections allowed). When I use svn up for url like 'http://.....' everything is cool (google chrome repository works perfect), but right now I need to svn up from server with 'svn://....' and I see connection refused. I've set proxy configuration in...
The `svn://` protocol is not compatible with HTTP proxies, as it uses a different transport mechanism. Since your network only allows HTTP connections through an HTTP proxy, you won't be able to connect to SVN repositories using the `svn://` protocol. Here are some potential solutions: ### 1. Use the HTTP(S) Protocol...
2,817
[ { "from": "human", "value": "I'm on laptop (Ubuntu) with a network that use HTTP proxy (only http connections allowed).\nWhen I use svn up for url like 'http://.....' everything is cool (google chrome repository works perfect), but right now I need to svn up from server with 'svn://....' and I see connectio...
I have a protocol that requires a length field up to 32-bits, and it must be generated at runtime to describe how many bytes are in a given packet. The code below is kind of ugly but I am wondering if this can be refactored to be slightly more efficient or easily understandable. The problem is that the code will only ...
The given code can indeed be refactored for better readability and efficiency. The current implementation uses a repetitive pattern that can be simplified by utilizing a loop. Additionally, you can eliminate unnecessary variables and make the code more concise. Here's a refactored version of your code: ```c extern ch...
2,332
[ { "from": "human", "value": "I have a protocol that requires a length field up to 32-bits, and it must be\ngenerated at runtime to describe how many bytes are in a given packet.\nThe code below is kind of ugly but I am wondering if this can be refactored to\nbe slightly more efficient or easily understandab...
How do I ask PowerShell where something is? For instance, "which notepad" and it returns the directory where the notepad.exe is run from according to the current paths.
In PowerShell, you can use the `Get-Command` cmdlet to find the location of an executable or command, similar to the `which` command in Unix-like systems. To find the location of `notepad.exe`, you would run the following command: ```powershell Get-Command notepad ``` This will return information about the `notepad...
4,892
[ { "from": "human", "value": "How do I ask PowerShell where something is? \nFor instance, \"which notepad\" and it returns the directory where the notepad.exe is run from according to the current paths.\n" }, { "from": "gpt", "value": "In PowerShell, you can use the `Get-Command` cmdlet to find ...
I'm pretty green still when it comes to web programming, I've spent most of my time on client applications. So I'm curious about the common exploits I should fear/test for in my site.
It's great that you're looking to improve your web security knowledge! Web applications are often targets for various types of exploits, and being aware of these can help you secure your site better. Here are some common vulnerabilities and exploits to watch out for: 1. **SQL Injection (SQLi)**: - Attackers can man...
2,841
[ { "from": "human", "value": "I'm pretty green still when it comes to web programming, I've spent most of my time on client applications. So I'm curious about the common exploits I should fear/test for in my site.\n" }, { "from": "gpt", "value": "It's great that you're looking to improve your we...
I want to be able to display a normal YouTube video with overlaid annotations, consisting of coloured rectangles for each frame. The only requirement is that this should be done programmatically. YouTube has annotations now, but require you to use their front end to create them by hand. I want to be able to generate t...
Creating a programmatic solution for overlaying annotations on YouTube videos can be a challenge, particularly since direct manipulation of YouTube's player or its annotations is against YouTube's terms of service. However, here are some legitimate approaches to achieve your goal while respecting YouTube's policies: #...
1,308
[ { "from": "human", "value": "I want to be able to display a normal YouTube video with overlaid annotations, consisting of coloured rectangles for each frame. The only requirement is that this should be done programmatically. \nYouTube has annotations now, but require you to use their front end to create the...
I'm trying to construct a find command to process a bunch of files in a directory using two different executables. Unfortunately, -exec on find doesn't allow to use pipe or even \| because the shell interprets that character first. Here is specifically what I'm trying to do (which doesn't work because pipe ends the ...
The `find` command doesn't support pipes (`|`) directly within the `-exec` action, as you mentioned. Instead, you can work around this limitation by using a shell to handle the piping for you. This can be accomplished by using `sh -c` to execute a command line that includes the pipe. Here's how you can achieve your go...
3,405
[ { "from": "human", "value": "I'm trying to construct a find command to process a bunch of files in a directory using two different executables. Unfortunately, -exec on find doesn't allow to use pipe or even \\| because the shell interprets that character first. \nHere is specifically what I'm trying to do...
When a java based application starts to misbehave on a windows machine, you want to be able to kill the process in the task manager if you can't quit the application normally. Most of the time, there's more than one java based application running on my machine. Is there a better way than just randomly killing java.exe ...
Yes, killing a specific Java process can be challenging, especially if there are multiple Java applications running simultaneously. However, there are a few methods you can use to identify and kill the correct Java process without randomly terminating them: ### 1. **Using Process Explorer:** As you've already discover...
3,534
[ { "from": "human", "value": "When a java based application starts to misbehave on a windows machine, you want to be able to kill the process in the task manager if you can't quit the application normally. Most of the time, there's more than one java based application running on my machine. Is there a better...
Using the TFS build server without VS 2008 Team System Tester Edition installed - is it possible to run a series of webtests as part of a build? I know that Webtests can only be recorded using the Tester Edition of VS. Here's a post about this from Jeff, back when he was at Vertigo. I'm just trying to run the tests, th...
Yes, you can run web tests as part of a build process in Team Foundation Server (TFS) without having the Visual Studio Team System Tester Edition installed. However, you will still need to have the Visual Studio Test Controller and Test Agent components installed on the build server to execute the web tests. Here are a...
4,423
[ { "from": "human", "value": "Using the TFS build server without VS 2008 Team System Tester Edition installed - is it possible to run a series of webtests as part of a build?\nI know that Webtests can only be recorded using the Tester Edition of VS. Here's a post about this from Jeff, back when he was at Ver...
My license for Whole Tomatoes Visual AssistX is about to expire and I'm not really planning on renewing it. I use it for spell checking but that's about it. The refactoring abilities have been a little disappointing. Before I just jump into Resharper though what are your thoughts on other possible plugins?
If you're looking for alternatives to Visual AssistX and are considering other options beyond ReSharper, there are several plugins and tools you might find useful, depending on your specific needs. Here are a few options to consider: 1. **CodeMaid**: This is a free Visual Studio extension that helps clean up and reorg...
2,028
[ { "from": "human", "value": "My license for Whole Tomatoes Visual AssistX is about to expire and I'm not really planning on renewing it. I use it for spell checking but that's about it. The refactoring abilities have been a little disappointing. Before I just jump into Resharper though what are your thou...
In my ASP.NET User Control I'm adding some JavaScript to the window.onload event: if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName)) Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, "window.onload = function() {myFunction();};", true); My pro...
To allow multiple user controls to execute JavaScript in the `window.onload` event without overwriting each other's handlers, you can modify your approach to register a function rather than directly assigning a new function to `window.onload`. You can use the `addEventListener` method to attach additional functions t...
1,754
[ { "from": "human", "value": "In my ASP.NET User Control I'm adding some JavaScript to the window.onload event:\nif (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName))\n Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName, \n \"window.onload = function() ...
As a long time World of Warcraft player, and a passionate developer I have decided that I would like to combine the two and set about developing some addins. Not only to improve my gameplay experience but as a great opportunity to learn something new. Does anyone have any advice on how to go about starting out? Is the...
It's great to hear that you're interested in developing add-ons for World of Warcraft! Building addons is a rewarding way to improve your gameplay experience and enhance your skills as a developer. Here’s a guide to help you get started: ### Getting Started with WoW Addon Development 1. **Learn the Basics:** - **L...
1,848
[ { "from": "human", "value": "As a long time World of Warcraft player, and a passionate developer I have decided that I would like to combine the two and set about developing some addins. Not only to improve my gameplay experience but as a great opportunity to learn something new.\nDoes anyone have any advi...
I'm working with Webby and am looking for some clarification. Can I define attributes like title or author in my layout?
Yes, in a Webby layout, you can define attributes like `title` and `author` in your layout files. The specific implementation may vary depending on the templating system or framework you are using, but generally, these attributes can be included in the layout's metadata or head section. For example, if you are using a...
4,847
[ { "from": "human", "value": "I'm working with Webby and am looking for some clarification. Can I define attributes like title or author in my layout?\n" }, { "from": "gpt", "value": "Yes, in a Webby layout, you can define attributes like `title` and `author` in your layout files. The specific i...
Uploading my first decently sized web app to my shared host provided me with a fresh set of challenges, by which I mean, sleepless nights. The issue was that I had most certainly not developed my application for medium trust (or had any clue what that was.) I mitigated all of the issues, save one. I had written an in...
Writing to the `web.config` file in a medium trust environment can indeed be a challenge, as medium trust imposes restrictions on file system access, which limits the ability to modify certain files, including `web.config`. Here are some potential solutions to address this issue: ### 1. Use an External Configuration F...
2,686
[ { "from": "human", "value": "Uploading my first decently sized web app to my shared host provided me with a fresh set of challenges, by which I mean, sleepless nights. The issue was that I had most certainly not developed my application for medium trust (or had any clue what that was.) \nI mitigated all of ...
As a consultant I get to toy around with many different products and APIs as the customer demands we use X and Y. I think it is great fun and I learn a lot from it. What will make a great developer over time is, in my opinion, the will to understand and learn new things. Therefore, I will always try to understand what ...
It's great to hear about your commitment to understanding the tools and technologies you work with! Diving deeper into the "behind the scenes" aspects of APIs and libraries can significantly enhance your skills and decision-making as a developer. As for your question, the amount of time developers spend on learning, ...
3,417
[ { "from": "human", "value": "As a consultant I get to toy around with many different products and APIs as the customer demands we use X and Y. I think it is great fun and I learn a lot from it.\nWhat will make a great developer over time is, in my opinion, the will to understand and learn new things. Theref...
When looking beyond the RAD (drag-drop and configure) way of building user interfaces that many tools encourage you are likely to come across three design patterns called Model-View-Controller, Model-View-Presenter and Model-View-ViewModel. My question has three parts to it: What issues do these patterns address? How ...
Great question! The Model-View-Controller (MVC), Model-View-Presenter (MVP), and Model-View-ViewModel (MVVM) design patterns are commonly used in software architecture to separate concerns, improve maintainability, and facilitate testing in user interface (UI) development. Let's dive into each part of your question. #...
1,251
[ { "from": "human", "value": "When looking beyond the RAD (drag-drop and configure) way of building user interfaces that many tools encourage you are likely to come across three design patterns called Model-View-Controller, Model-View-Presenter and Model-View-ViewModel. My question has three parts to it:\n\n...
I am writing an immutable DOM tree in Java, to simplify access from multiple threads.* However, it does need to support inserts and updates as fast as possible. And since it is immutable, if I make a change to a node on the N'th level of the tree, I need to allocate at least N new nodes in order to return the new tree...
Using a pool of pre-allocated nodes can indeed be a worthwhile optimization for an immutable DOM tree in Java. Here are some points to consider regarding the performance implications and other suggestions for improving your implementation: ### 1. Node Pooling - **Performance Gain**: By pooling nodes, you can reduce th...
2,727
[ { "from": "human", "value": "I am writing an immutable DOM tree in Java, to simplify access from multiple threads.*\nHowever, it does need to support inserts and updates as fast as possible. And since it is immutable, if I make a change to a node on the N'th level of the tree, I need to allocate at least N ...
We're trying to get rid of all of our SQL Server 2000 databases to re purpose our old DB server... Sharepoint 3.0 is being a showstopper. I've looked at a lot of guides from Microsoft and tried the instructions in those. I've also just tried the good ol' exec sp_detach_db / sp_attach_db with no luck. Has anyone actual...
Migrating or removing SharePoint 3.0 from SQL Server 2000 can be quite challenging, especially since SharePoint is heavily dependent on its database. Here are some steps you can follow to help you successfully detach or migrate SharePoint databases: ### Steps to Remove SharePoint 3.0 Databases from SQL Server 2000: 1...
2,165
[ { "from": "human", "value": "We're trying to get rid of all of our SQL Server 2000 databases to re purpose our old DB server... Sharepoint 3.0 is being a showstopper. \nI've looked at a lot of guides from Microsoft and tried the instructions in those. I've also just tried the good ol' exec sp_detach_db / sp...
Does anyone know a good Java lib that will hook into SVN so I can extract the data? I want the SVN comments, author, path, etc... Hopefully with this data I can build a better time management tracking system.
Yes, there are several Java libraries that you can use to interact with Subversion (SVN) and extract data like comments, authors, paths, etc. Here are some popular options: 1. **SVNKit**: SVNKit is a pure Java library for Subversion that provides an API for accessing SVN repositories. It allows you to perform SVN oper...
1,837
[ { "from": "human", "value": "Does anyone know a good Java lib that will hook into SVN so I can extract the data? I want the SVN comments, author, path, etc... Hopefully with this data I can build a better time management tracking system.\n" }, { "from": "gpt", "value": "Yes, there are several ...
I have a .NET 2.0 windows forms app, which makes heavy use of the ListView control. I've subclassed the ListView class into a templated SortableListView<T> class, so it can be a bit smarter about how it displays things, and sort itself. Unfortunately this seems to break the Visual Studio Forms Designer, in both VS2005 ...
The issues you're encountering with the Visual Studio Forms Designer are common when dealing with generics and custom controls. Here are several strategies you can try to resolve the problems: ### 1. Remove Generics for Designer Compatibility The Visual Studio Forms Designer struggles with generics in custom controls....
1,068
[ { "from": "human", "value": "I have a .NET 2.0 windows forms app, which makes heavy use of the ListView control.\nI've subclassed the ListView class into a templated SortableListView<T> class, so it can be a bit smarter about how it displays things, and sort itself.\nUnfortunately this seems to break the Vi...
One of the topics that seems to come up regularly on mailing lists and online discussions is the merits (or lack thereof) of doing a Computer Science Degree. An argument that seems to come up time and again for the negative party is that they have been coding for some number of years and they have never used recursion....
### What is Recursion? Recursion is a programming and mathematical concept where a function calls itself to solve smaller instances of the same problem. A recursive function typically has two main components: 1. **Base Case**: This is a condition that stops the recursion to prevent infinite loops. It defines the simp...
2,580
[ { "from": "human", "value": "One of the topics that seems to come up regularly on mailing lists and online discussions is the merits (or lack thereof) of doing a Computer Science Degree. An argument that seems to come up time and again for the negative party is that they have been coding for some number of ...
Using TortoiseSVN against VisualSVN I delete a source file that I should not have deleted. Now this isn't a train smash because I can get the file back from the daily backup. However I would like to undelete it from SVN (VisualSVN) so that I can get the history back. However I can't work out how to do that. Anybody kno...
To undelete a file in VisualSVN or using TortoiseSVN, you can follow these steps. The process is essentially about reverting the deletion and restoring the file from the Subversion history. ### Using VisualSVN: 1. **Open VisualSVN**: Launch VisualSVN and navigate to the repository browser. 2. **Navigate to the Rep...
1,330
[ { "from": "human", "value": "Using TortoiseSVN against VisualSVN I delete a source file that I should not have deleted. Now this isn't a train smash because I can get the file back from the daily backup. However I would like to undelete it from SVN (VisualSVN) so that I can get the history back. However I c...
I am working with a PC based automation software package called Think'n'Do created by Phoenix Contact It does real time processing, read inputs/ control logic / write outputs all done in a maximum of 50ms. We have an OPC server that is reading/writing tags from a PLC every 10ms. There is a long delay in writing a tag t...
Based on your description, it seems that the processing time you're observing (up to 6 seconds) far exceeds the theoretical maximum time you calculated (130 ms). Here are several areas you might consider investigating to identify where the bottleneck may be occurring: 1. **Network Latency**: - Check if there are an...
1,477
[ { "from": "human", "value": "I am working with a PC based automation software package called Think'n'Do created by Phoenix Contact It does real time processing, read inputs/ control logic / write outputs all done in a maximum of 50ms. We have an OPC server that is reading/writing tags from a PLC every 10ms....
I use RCF with boost.serialization (why use RCF's copy when we already use the original?) It works OK, but when an exception is thrown in the server, it's not passed correctly to the client. Instead, I get an RCF::SerializationException quoting an archive_exception saying "class name too long". When I change the protoc...
When dealing with remote exceptions in RCF (Remote Call Framework) and Boost.Serialization, it’s important to ensure that the exceptions you want to serialize are correctly registered and that the serialization formats are compatible. Here are some steps and tips to help you troubleshoot and resolve the issue: ### 1. ...
2,007
[ { "from": "human", "value": "I use RCF with boost.serialization (why use RCF's copy when we already use the original?) It works OK, but when an exception is thrown in the server, it's not passed correctly to the client. Instead, I get an RCF::SerializationException quoting an archive_exception saying \"clas...
The StackOverflow transcripts are enormous, and sometimes I want to link to a little bit within it. How do I create an HTML anchor in a FogBugz wiki page?
In FogBugz, you can create HTML anchors by using a combination of wiki syntax and HTML tags. Here’s how you can do it: 1. **Create an Anchor**: To create an anchor, you can use an HTML `id` attribute on an element. Since FogBugz wiki supports HTML, you can insert your anchor directly within a paragraph or header. For ...
3,473
[ { "from": "human", "value": "The StackOverflow transcripts are enormous, and sometimes I want to link to a little bit within it.\nHow do I create an HTML anchor in a FogBugz wiki page?\n" }, { "from": "gpt", "value": "In FogBugz, you can create HTML anchors by using a combination of wiki syntax ...
Does anyone know if you can and how to start off a scheduled Windows task on a Remote Server from within a SQL Server Integration Services (SSIS) package?
Yes, you can start a scheduled Windows task on a remote server from within a SQL Server Integration Services (SSIS) package. This can be achieved by using several methods, including executing PowerShell scripts or command line tools. Below are two common approaches you can use: ### Method 1: Using PowerShell 1. **Cre...
1,778
[ { "from": "human", "value": "Does anyone know if you can and how to start off a scheduled Windows task on a Remote Server from within a SQL Server Integration Services (SSIS) package?\n" }, { "from": "gpt", "value": "Yes, you can start a scheduled Windows task on a remote server from within a SQ...
In php I have open a .php file and want to evaluate certain lines. Specifically when the $table_id and $line variables are assigned a value. Within the text file I have: ... $table_id = 'crs_class'; // table name $screen = 'crs_class.detail.screen.inc'; // file identifying screen structure ....
The issue with your `if` statement lies in how you're using the `stripos` function and interpreting its return value. The `stripos` function searches for the position of a substring (case-insensitive) within a string. If it finds the substring, it returns the index of its first occurrence. If it does not find the subs...
3,459
[ { "from": "human", "value": "In php I have open a .php file and want to evaluate certain lines. Specifically when the $table_id and $line variables are assigned a value.\nWithin the text file I have:\n... \n$table_id = 'crs_class'; // table name\n$screen = 'crs_class.detail.screen.in...
I'm looking for some software to monitor a single server for performance alerts. Preferably free and with a reasonable default configuration. Edit: To clarify, I would like to run this software on a Windows machine and monitor a remote Windows server for CPU/memory/etc. usage alerts (not a single application). Edit: I ...
For monitoring a Windows server's performance (CPU, memory, disk usage, etc.) and receiving alerts, you have several options that can suit your needs. Here are some free tools you might consider: 1. **Windows Performance Monitor**: You mentioned this yourself, but it's worth expanding on. You can set up Performance Mo...
1,958
[ { "from": "human", "value": "I'm looking for some software to monitor a single server for performance alerts. Preferably free and with a reasonable default configuration.\nEdit: To clarify, I would like to run this software on a Windows machine and monitor a remote Windows server for CPU/memory/etc. usage a...
Project Darkstar was the topic of the monthly JavaSIG meeting down at the Google offices in NYC last night. For those that don't know (probably everyone), Project Darkstar is a framework for massively multiplayer online games that attempts to take care of all of the "hard stuff." The basic idea is that you write your...
Your concerns about Project Darkstar highlight some significant challenges that any framework targeting the massively multiplayer online game (MMO) industry might face. Here's a breakdown of some key points: ### 1. **Java as the Language of Choice** - **Perception of Java**: The sentiment that "everyone in the game...
1,878
[ { "from": "human", "value": "Project Darkstar was the topic of the monthly JavaSIG meeting down at the Google offices in NYC last night. For those that don't know (probably everyone), Project Darkstar is a framework for massively multiplayer online games that attempts to take care of all of the \"hard stuf...
Is there a way I can configure the MidPointRounding enumeration default setting in a config file (I.e. web.config or app.config) I have a considerable source code base, and I need to configure at the application scope how rounding will occur, whether used in Math.Round or decimal type rounding... I would like to do t...
In .NET, there is no built-in way to globally configure the `MidpointRounding` enumeration directly through a `web.config` or `app.config` file. The `MidpointRounding` behavior is inherently tied to how you call methods like `Math.Round` or how decimals behave in your code. However, you can achieve consistent rounding...
2,643
[ { "from": "human", "value": "Is there a way I can configure the MidPointRounding enumeration default setting in a config file (I.e. web.config or app.config) I have a considerable source code base, and I need to configure at the application scope how rounding will occur, whether used in Math.Round or decim...
I am designing a new System and I have a lot of Interfaces that will grow over time with the system. What is the best practice to name this interfaces ISomethingV01 ISomethingV02 etc and I do this public interface ISomething{ void method(); } then I have to add method 2 so now what I do? public interface ISomet...
When designing a system with interfaces that are expected to grow and evolve over time, it's important to adopt a clear and maintainable naming convention and structure. Here are some best practices you can consider for versioning and extending your interfaces: ### Naming Conventions 1. **Avoid Version Numbers in Int...
1,334
[ { "from": "human", "value": "I am designing a new System and I have a lot of Interfaces that will grow over time with the system. What is the best practice to name this interfaces\nISomethingV01\nISomethingV02\netc\n\nand I do this\npublic interface ISomething{\n void method();\n}\n\nthen I have to add...
Is it possible to use Apache Subversion (SVN) as general purpose backup tool? (As a kind of rsync alternative.)
Apache Subversion (SVN) is primarily a version control system designed for managing source code and tracking changes to files and directories over time. While it can store and manage different versions of files, it is not optimized for general-purpose backup tasks in the same way tools like `rsync` are. However, there ...
3,315
[ { "from": "human", "value": "Is it possible to use Apache Subversion (SVN) as general purpose backup tool? (As a kind of rsync alternative.)\n" }, { "from": "gpt", "value": "Apache Subversion (SVN) is primarily a version control system designed for managing source code and tracking changes to fi...
I've created a map system for a game that runs on the principle of drawing the picture of the map from tiles. There are many reasons for this which I won't go into here but if you really want to know then I'm sure you can find out how to contact me ;) I have made the latest version live so you can see exactly where the...
It sounds like you're encountering a rendering issue with your tile-based map system, specifically with how the tiles are being drawn or aligned. Without seeing the actual source code and the accompanying image, I can provide some general troubleshooting steps and tips to help you identify and fix the problem. 1. **Ch...
3,807
[ { "from": "human", "value": "I've created a map system for a game that runs on the principle of drawing the picture of the map from tiles. There are many reasons for this which I won't go into here but if you really want to know then I'm sure you can find out how to contact me ;)\nI have made the latest ver...
I have a core file generated on a remote system that I don't have direct access to. I also have local copies of the library files from the remote system, and the executable file for the crashing program. I'd like to analyse this core dump in gdb. For example: gdb path/to/executable path/to/corefile My libraries are i...
In GDB, you can specify additional library search paths using the `set substitute-path` command to instruct GDB to use specific paths for debugging symbols and libraries. Since you want GDB to look for libraries relative to your current directory, you can set the substitution path to map the original paths of the libra...
4,098
[ { "from": "human", "value": "I have a core file generated on a remote system that I don't have direct access to. I also have local copies of the library files from the remote system, and the executable file for the crashing program.\nI'd like to analyse this core dump in gdb.\nFor example:\ngdb path/to/exe...
I've run into a strange syntax in Boo Language Guide : setter = { value | a = value } What does the | operator mean?
In the Boo programming language, the `|` operator is used to denote a block parameter in the context of a lambda expression or an anonymous function. The syntax you encountered in the setter example: ```boo setter = { value | a = value } ``` is defining a function (or a block) that takes a parameter named `value`. In...
4,078
[ { "from": "human", "value": "I've run into a strange syntax in Boo Language Guide :\nsetter = { value | a = value }\n\nWhat does the | operator mean?\n" }, { "from": "gpt", "value": "In the Boo programming language, the `|` operator is used to denote a block parameter in the context of a lambda ...
I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search" , "Web/Home" etc. It would be nice to be able to bind these keys so they execute arbitrary programs. Does anybody know how to do this in Debian Etch?
To bind non-standard keys on a Microsoft keyboard (or any keyboard with extra multimedia/function buttons) to execute arbitrary programs in Debian Etch, you can use the `xbindkeys` utility in combination with a few other tools. Here are the steps to set it up: 1. **Install Necessary Packages**: Make sure you have `...
1,834
[ { "from": "human", "value": "I have a Microsoft keyboard with a series of non-standard buttons such as \"Mail\", \"Search\" , \"Web/Home\" etc.\nIt would be nice to be able to bind these keys so they execute arbitrary programs.\nDoes anybody know how to do this in Debian Etch?\n" }, { "from": "gpt",...
In the Windows applications I work on, we have a custom framework that sits directly above Win32 (don't ask). When we create a window, our normal practice is to put this in the window's user data area via SetWindowLong(hwnd, GWL_USERDATA, this), which allows us to have an MFC-like callback or a tightly integrated WndP...
In 64-bit Windows, the `GWL_USERDATA` field in the `SetWindowLong` and `GetWindowLong` functions is indeed only 32-bits wide, which means that you cannot store a pointer (which is 64-bits wide on a 64-bit system) directly in that field. However, there are alternative solutions that you can use to store a pointer in a w...
2,612
[ { "from": "human", "value": "In the Windows applications I work on, we have a custom framework that sits directly above Win32 (don't ask). When we create a window, our normal practice is to put this in the window's user data area via SetWindowLong(hwnd, GWL_USERDATA, this), which allows us to have an MFC-l...
How do you create your own custom moniker (or URL Protocol) on Windows systems? Examples: http: mailto: service:
Creating a custom URL protocol (also known as a moniker) on Windows allows you to define a unique protocol that your application can respond to. Here’s how you can create a custom URL protocol in Windows: ### Steps to Create a Custom URL Protocol 1. **Open the Registry Editor**: - Press `Windows + R`, type `regedi...
694
[ { "from": "human", "value": "How do you create your own custom moniker (or URL Protocol) on Windows systems?\nExamples:\n\nhttp:\nmailto:\nservice:\n\n" }, { "from": "gpt", "value": "Creating a custom URL protocol (also known as a moniker) on Windows allows you to define a unique protocol that y...
I have an unusual situation in which I need a SharePoint timer job to both have local administrator windows privileges and to have SHAREPOINT\System SharePoint privileges. I can get the windows privileges by simply configuring the timer service to use an account which is a member of local administrators. I understand t...
Your situation is quite complex, and it involves the interplay between SharePoint's architecture and Windows service permissions. It's generally not recommended to run the SharePoint Timer Service as a local administrator or under an account with elevated permissions due to security best practices. Here are a few appro...
2,588
[ { "from": "human", "value": "I have an unusual situation in which I need a SharePoint timer job to both have local administrator windows privileges and to have SHAREPOINT\\System SharePoint privileges.\nI can get the windows privileges by simply configuring the timer service to use an account which is a mem...
I see in the Stack Overflow footer that the SVN Revision number is displayed. Is this automated and if so, how does one implement it in ASP.NET? (Solutions in other languages are acceptable)
Yes, displaying the version control revision number (like the SVN revision) in a web application footer is a common practice and can be automated. The idea is to incorporate the revision number during the build process or deployment so that it's accessible in the application. ### How to Implement SVN Revision in ASP.N...
2,162
[ { "from": "human", "value": "I see in the Stack Overflow footer that the SVN Revision number is displayed. Is this automated and if so, how does one implement it in ASP.NET?\n(Solutions in other languages are acceptable)\n" }, { "from": "gpt", "value": "Yes, displaying the version control revisi...
Are there conventions for function names when using the Perl Test::More or Test::Simple modules? I'm specifically asking about the names of functions that are used to set up a test environment before the test and to tear down the environment after successful completion of the test(s). cheers, Rob
In Perl's testing frameworks such as `Test::More` or `Test::Simple`, there are no strict naming conventions enforced by the modules themselves. However, there are common practices that many Perl developers follow for clarity and maintainability. ### Common Practices for Test Setup and Teardown 1. **Naming Functions**...
2,049
[ { "from": "human", "value": "Are there conventions for function names when using the Perl Test::More or Test::Simple modules?\nI'm specifically asking about the names of functions that are used to set up a test environment before the test and to tear down the environment after successful completion of the t...
I have been learning C++ for a while now, I find it very powerful. But, the problem is the the level of abstraction is not much and I have to do memory management myself. What are the languages that I can use which uses a higher level of abstraction.
If you're looking for programming languages that provide a higher level of abstraction than C++ and manage memory for you, here are several options: 1. **Java**: Java is a widely-used, object-oriented language that has automatic garbage collection, which means you don’t have to manually manage memory. It also has a ri...
2,859
[ { "from": "human", "value": "I have been learning C++ for a while now, I find it very powerful. But, the problem is the the level of abstraction is not much and I have to do memory management myself. \nWhat are the languages that I can use which uses a higher level of abstraction.\n" }, { "from": "g...
I would like to save the programs settings every time the user exits the program. So I need a way to call a function when the user quits the program. How do I do that? I am using Java 1.5.
In Java, you can handle the shutdown process of a program using the `Runtime.addShutdownHook(Thread hook)` method, which allows you to specify a thread that will be executed when the Java Virtual Machine (JVM) is shutting down. This is particularly useful for saving settings or performing cleanup tasks before the appli...
2,625
[ { "from": "human", "value": "I would like to save the programs settings every time the user exits the program. So I need a way to call a function when the user quits the program. How do I do that?\nI am using Java 1.5.\n" }, { "from": "gpt", "value": "In Java, you can handle the shutdown process...
I'm using two different libraries in my project, and both of them supply a basic rectangle struct. The problem with this is that there seems to be no way to insert a conversion between the types, so I can't call a function in one library with the result from a function in the other. If I was the author of either of the...
In situations like this where you cannot modify the original structures or classes, and you want to have seamless conversions between them, you can use a combination of factory functions and wrapper classes to achieve your goal. Here’s a suggested approach: 1. **Create a Wrapper Class for Library A's Rectangle**: Th...
1,674
[ { "from": "human", "value": "I'm using two different libraries in my project, and both of them supply a basic rectangle struct. The problem with this is that there seems to be no way to insert a conversion between the types, so I can't call a function in one library with the result from a function in the ot...
Why is the following C# code not allowed: public abstract class BaseClass { public abstract int Bar { get;} } public class ConcreteClass : BaseClass { public override int Bar { get { return 0; } set {} } } CS0546 'ConcreteClass.Bar.set': cannot override because 'BaseClass.Bar' does no...
The C# error you are encountering (`CS0546`) is related to the way you are trying to override the property `Bar` in the `ConcreteClass`. Specifically, the error message indicates that you are attempting to provide a setter for the property `Bar` in `ConcreteClass`, but the base class `BaseClass` only defines an abstrac...
2,718
[ { "from": "human", "value": "Why is the following C# code not allowed:\npublic abstract class BaseClass\n{\n public abstract int Bar { get;}\n}\n\npublic class ConcreteClass : BaseClass\n{\n public override int Bar\n {\n get { return 0; }\n set {}\n }\n}\n\n\nCS0546 'ConcreteClass....
What is WCF in simple terms? It's hard to distill the meaning from the Wikipedia page.
WCF stands for Windows Communication Foundation. In simple terms, it is a framework developed by Microsoft that allows different applications to communicate with each other, regardless of the platforms they are running on. Think of WCF as a set of tools that helps developers create services that can send and receive ...
5,365
[ { "from": "human", "value": "What is WCF in simple terms?\nIt's hard to distill the meaning from the Wikipedia page.\n" }, { "from": "gpt", "value": "WCF stands for Windows Communication Foundation. In simple terms, it is a framework developed by Microsoft that allows different applications to c...
I see many user interface control libraries for .NET, but where can I get similar stuff for win32 using simply C/C++? Things like prettier buttons, dials, listviews, graphs, etc. Seems every Win32 programmers' right of passage is to end up writing his own collection. :/ No MFC controls please. I only do pure C/C++. ...
Creating rich user interfaces in Win32 using pure C/C++ can indeed be a challenging task, especially for platforms like Windows Mobile where you have constraints such as not using MFC or .NET. However, there are a few options and libraries you might consider that can help you achieve a polished UI without the overhead ...
2,384
[ { "from": "human", "value": "I see many user interface control libraries for .NET, but where can I get similar stuff for win32 using simply C/C++?\nThings like prettier buttons, dials, listviews, graphs, etc.\nSeems every Win32 programmers' right of passage is to end up writing his own collection. :/\n\nNo...
How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters. Any language would work, but it should be portable.
To generate a list of all possible permutations of a string with a specified minimum (`x`) and maximum (`y`) length, containing a variable list of characters, you can use Python. Python is widely regarded as a portable language, and its standard library provides excellent tools for working with permutations. Below is ...
2,277
[ { "from": "human", "value": "How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters.\nAny language would work, but it should be portable.\n" }, { "from": "gpt", "value": "To generate a list of...
When you are doing integration tests with either just your data access layer or the majority of the application stack. What is the best way prevent multiple tests from clashing with each other if they are run on the same database?
When running integration tests against a shared database, it’s essential to prevent tests from interfering with each other to ensure consistent and reliable test outcomes. Here are several strategies to achieve this: 1. **Transactional Tests**: - Wrap each test case in a database transaction. At the beginning of ea...
3,234
[ { "from": "human", "value": "When you are doing integration tests with either just your data access layer or the majority of the application stack. What is the best way prevent multiple tests from clashing with each other if they are run on the same database?\n" }, { "from": "gpt", "value": "Whe...
My team is moving from Visual SourceSafe to Subversion soon, while developing/supporting a legacy project in Visual Basic 6.0, so I have a couple of questions: What's the best tool for Subversion IDE integration in Visual Studio 6? (or is it not worth the trouble...) Are there any best practices for using Subversion w...
Transitioning from Visual SourceSafe to Subversion (SVN) is a common challenge for teams working with legacy applications like those developed in Visual Basic 6.0. Here are some insights and recommendations for your migration and integration. ### Best Tool for Subversion IDE Integration with Visual Studio 6 Visual St...
1,410
[ { "from": "human", "value": "My team is moving from Visual SourceSafe to Subversion soon, while developing/supporting a legacy project in Visual Basic 6.0, so I have a couple of questions:\n\nWhat's the best tool for Subversion IDE integration in Visual Studio 6? (or is it not worth the trouble...)\nAre the...
Whilst starting to learn lisp, I've come across the term tail-recursive. What does it mean exactly?
In programming, particularly in functional programming languages like Lisp, "tail recursion" is a special case of recursion where the recursive call is the last operation performed in the function. This means that when a function is tail-recursive, it doesn't need to keep track of the previous state of the function whe...
2,539
[ { "from": "human", "value": "Whilst starting to learn lisp, I've come across the term tail-recursive. What does it mean exactly?\n" }, { "from": "gpt", "value": "In programming, particularly in functional programming languages like Lisp, \"tail recursion\" is a special case of recursion where th...
I need to enable/disable completely network interfaces from a script in Windows XP. I'm looking for a python solution, but any general way (eg WMI, some command-line à la netsh, some windows call) is welcome and will be adjusted. Thanks.
To enable or disable network interfaces in Windows XP, you can use the built-in `netsh` command-line utility. Here's how you can achieve this with a Python script that calls `netsh`. ### Using `netsh` Command You can use the following commands to enable and disable a network interface: - To disable a network interfa...
3,722
[ { "from": "human", "value": "I need to enable/disable completely network interfaces from a script in Windows XP. I'm looking for a python solution, but any general way (eg WMI, some command-line à la netsh, some windows call) is welcome and will be adjusted. Thanks.\n" }, { "from": "gpt", "value...
I know that .NET is JIT compiled to the architecture you are running on just before the app runs, but does the JIT compiler optimize for 64bit architecture at all? Is there anything that needs to be done or considered when programming an app that will run on a 64bit system? (i.e. Will using Int64 improve performance ...
Yes, the .NET Just-In-Time (JIT) compiler does optimize code for the architecture it is running on, whether that is 32-bit or 64-bit. When a .NET application is executed, the JIT compiler translates the Intermediate Language (IL) code into native machine code for the specific architecture. ### Considerations When Pro...
2,739
[ { "from": "human", "value": "I know that .NET is JIT compiled to the architecture you are running on just before the app runs, but does the JIT compiler optimize for 64bit architecture at all? \nIs there anything that needs to be done or considered when programming an app that will run on a 64bit system? (...
I see a lot of talk on here about functional languages and stuff. Why would you use one over a "traditional" language? What do they do better? What are they worse at? What's the ideal functional programming application?
Functional programming (FP) languages offer a different paradigm compared to traditional languages, often categorized as imperative or object-oriented (like C, Java, or Python). Here are some key reasons to consider using a functional language, along with their advantages, disadvantages, and ideal applications: ### Ad...
1,413
[ { "from": "human", "value": "I see a lot of talk on here about functional languages and stuff. Why would you use one over a \"traditional\" language? What do they do better? What are they worse at? What's the ideal functional programming application?\n" }, { "from": "gpt", "value": "Function...
We've been trying to alter a lot of columns from nullable to not nullable, which involves dropping all the associated objects, making the change, and recreating the associated objects. We've been using SQL Compare to generate the scripts, but I noticed that SQL Compare doesn't script statistic objects. Does this mean i...
When you alter columns from nullable to not nullable in SQL Server, particularly when there are existing statistics on those columns, it’s important to understand the role of statistics in query optimization and execution. Statistics objects in SQL Server help the query optimizer to estimate the cardinality of query r...
2,659
[ { "from": "human", "value": "We've been trying to alter a lot of columns from nullable to not nullable, which involves dropping all the associated objects, making the change, and recreating the associated objects.\nWe've been using SQL Compare to generate the scripts, but I noticed that SQL Compare doesn't ...
I'm trying to setup CruiseControl.net webdashboard at the moment. So far it works nice, but I have a problem with the NAnt Build Timing Report. Firstly, my current ccnet.config file looks something like this: <project name="bla"> ... <prebuild> <nant .../> </prebuild> <tasks> <nant .../> </tasks> <publishers> <nant ...
The issue you're encountering with the NAnt Build Timing Report displaying duplicate summaries is a common problem that can arise when NAnt tasks are executed multiple times throughout the project lifecycle. Each phase (prebuild, tasks, and publishers) is executing NAnt, and this can lead to duplicate reporting. To ad...
1,611
[ { "from": "human", "value": "I'm trying to setup CruiseControl.net webdashboard at the moment. So far it works nice, but I have a problem with the NAnt Build Timing Report.\nFirstly, my current ccnet.config file looks something like this:\n<project name=\"bla\">\n...\n<prebuild>\n <nant .../>\n</prebuild>\n...
I'm looking for help setting a new default property value for an inherited control in Visual Studio: class NewCombo : System.Windows.Forms.ComboBox { public NewCombo() { DropDownItems = 50; } } The problem is that the base class property DropDownItems has a 'default' attribute set on it that is a different value (no...
In .NET WinForms, there is no way to directly modify the default value of a property in a base class via attributes in a derived class. The default values defined in the base class remain fixed, and when you create a derived control, the designer uses the default values set in the base class, not the constructor or any...
2,880
[ { "from": "human", "value": "I'm looking for help setting a new default property value for an inherited control in Visual Studio:\nclass NewCombo : System.Windows.Forms.ComboBox\n{\n public NewCombo() { DropDownItems = 50; }\n}\n\nThe problem is that the base class property DropDownItems has a 'default' at...
I'm a keyboard junkie. I love having a key sequence to do everything. What are your favorite keyboard shortcuts? I'll start by naming a couple of mine: 1 - Alt-Space to access the windows menu for the current window 2 - F2 to rename a file in Windows Explorer
As a fellow keyboard enthusiast, I appreciate the efficiency that shortcuts bring! Here are some of my favorite keyboard shortcuts that can boost productivity across various applications and systems: ### General Windows Shortcuts: 1. **Windows + D**: Show or hide the desktop. 2. **Alt + Tab**: Switch between open appl...
4,010
[ { "from": "human", "value": "I'm a keyboard junkie. I love having a key sequence to do everything. What are your favorite keyboard shortcuts?\nI'll start by naming a couple of mine:\n1 - Alt-Space to access the windows menu for the current window\n2 - F2 to rename a file in Windows Explorer\n" }, { ...
So far I have encountered adjacency list, nested sets and nested intervals as models for storing tree structures in a database. I know these well enough and have migrated trees from one to another. What are other popular models? What are their characteristics? What are good resources (books, web, etc) on this topic? I'...
There are several models for storing tree structures in databases, each with its own advantages and disadvantages depending on the context of usage. Here's a rundown of some popular models beyond the adjacency list, nested sets, and nested intervals, along with their characteristics: ### 1. **Materialized Path** - **D...
1,056
[ { "from": "human", "value": "So far I have encountered adjacency list, nested sets and nested intervals as models for storing tree structures in a database. I know these well enough and have migrated trees from one to another.\nWhat are other popular models? What are their characteristics? What are good res...
I've been asked to help out on an XNA project with the AI. I'm not totally new to the concepts (pathfinding, flocking, etc.) but this would be the first "real" code. I'd be very thankful for any resources (links or books); I want to make sure I do this right.
Working on AI for an XNA project can be a rewarding experience, especially if you're diving into pathfinding and flocking behaviors. Here are some resources and ideas to help you get started: ### Books and Reading Material 1. **"Artificial Intelligence for Games" by Ian Millington and John Funge**: - This book pro...
1,842
[ { "from": "human", "value": "I've been asked to help out on an XNA project with the AI. I'm not totally new to the concepts (pathfinding, flocking, etc.) but this would be the first \"real\" code. I'd be very thankful for any resources (links or books); I want to make sure I do this right.\n" }, { "...
This isn't a design question, really, though it may seem like it. (Well, okay, it's kind of a design question). What I'm wondering is why the C++ std::fstream classes don't take a std::string in their constructor or open methods. Everyone loves code examples so: #include <iostream> #include <fstream> #include <string> ...
The reason that the C++ `std::fstream`, `std::ifstream`, and `std::ofstream` classes do not directly accept `std::string` parameters in their constructors or open methods primarily relates to the historical context of C++ and the nature of the C-style strings (C-style `char*`) that were prevalent before the introductio...
2,075
[ { "from": "human", "value": "This isn't a design question, really, though it may seem like it. (Well, okay, it's kind of a design question). What I'm wondering is why the C++ std::fstream classes don't take a std::string in their constructor or open methods. Everyone loves code examples so:\n#include <iostr...
What is the easiest way to create and verify PGP/GPG signatures from within a Python application? I can call pgp or gpg using subprocess and parse the output, but I was looking for a way that didn't require an external program to be installed (my application is cross-platform mac/windows/unix).
If you're looking to create and verify PGP/GPG signatures from within a Python application without relying on external command-line tools, you can use libraries such as `python-gnupg`, `pgpy`, or `gnupg`. However, the recommended approach for cross-platform compatibility and ease of use is `pgpy`, which is a pure Pytho...
1,416
[ { "from": "human", "value": "What is the easiest way to create and verify PGP/GPG signatures from within a Python application? \nI can call pgp or gpg using subprocess and parse the output, but I was looking for a way that didn't require an external program to be installed (my application is cross-platform ...
I'm playing around with a native (non-web) single-player game I'm writing, and it occured to me that having a daily/weekly/all-time online highscore list (think Xbox Live Leaderboard) would make the game much more interesting, adding some (small) amount of community and competition. However, I'm afraid people would see...
Implementing an online highscore list or leaderboard for a native single-player game is a great idea for enhancing player engagement. However, you're right to be concerned about the potential for hacking and score manipulation. Here are some strategies to help mitigate cheating while allowing for a competitive atmosphe...
2,052
[ { "from": "human", "value": "I'm playing around with a native (non-web) single-player game I'm writing, and it occured to me that having a daily/weekly/all-time online highscore list (think Xbox Live Leaderboard) would make the game much more interesting, adding some (small) amount of community and competit...
I have over a million text files compressed into 40 zip files. I also have a list of about 500 model names of phones. I want to find out the number of times a particular model was mentioned in the text files. Is there any python module which can do a regex match on the files without unzipping it. Is there a simple way...
Yes, you can search for text within zip files without needing to unzip them first by using the `zipfile` module in Python. While you cannot use regex directly on zipped files, you can read the contents of the files inside the zip archives and then apply regex to the text. Here's a step-by-step guide on how to do this:...
2,151
[ { "from": "human", "value": "I have over a million text files compressed into 40 zip files. I also have a list of about 500 model names of phones. I want to find out the number of times a particular model was mentioned in the text files. \nIs there any python module which can do a regex match on the files w...
How do I select all records that contain "LCS" within the title column in sql.
To select all records from a table where the `title` column contains the substring "LCS", you can use the `LIKE` operator in your SQL query. Here's a general syntax for it: ```sql SELECT * FROM your_table_name WHERE title LIKE '%LCS%'; ``` In this query: - `your_table_name` should be replaced with the actual name of...
5,350
[ { "from": "human", "value": "How do I select all records that contain \"LCS\" within the title column in sql.\n" }, { "from": "gpt", "value": "To select all records from a table where the `title` column contains the substring \"LCS\", you can use the `LIKE` operator in your SQL query. Here's a g...
I am thinking about providing a version of say, the database schema and the dlls for business logic in the footer of my web application. Is this advised? Are there any pitfalls, or pointers of how to do this best? Usability concerns? I already have a version scheme, for both schema and dlls, used in my CI solution.
Providing version information for your database schema and business logic DLLs in the footer of your web application can be a double-edged sword. Here are some considerations, potential pitfalls, and best practices to help you make an informed decision. ### Pros of Showing Version Information 1. **Transparency**: Use...
1,626
[ { "from": "human", "value": "I am thinking about providing a version of say, the database schema and the dlls for business logic in the footer of my web application.\nIs this advised?\nAre there any pitfalls, or pointers of how to do this best?\nUsability concerns?\nI already have a version scheme, for both...
I am currently building in Version 3.5 of the .Net framework and I have a resource (.resx) file that I am trying to access in a web application. I have exposed the .resx properties as public access modifiers and am able to access these properties in the controller files or other .cs files in the web app. My question ...
Yes, it is possible to access resource files directly within your ASP.NET view pages using the syntax you provided. In ASP.NET, resource files (.resx) are commonly used to manage localization and access string resources. The syntax you mentioned is indeed the correct way to reference resources in your ASP.NET MVC views...
2,175
[ { "from": "human", "value": "I am currently building in Version 3.5 of the .Net framework and I have a resource (.resx) file that I am trying to access in a web application. I have exposed the .resx properties as public access modifiers and am able to access these properties in the controller files or othe...
This page from Adobe says to add a "wmode" parameter and set its value to "transparent": http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_1420 This works flawlessly in IE. The background renders correctly in Firefox and Safari, however as soon as you use the browser's scroll bar then mouse over the Flash c...
The behavior you're experiencing is a common issue with Flash and the handling of the "wmode" parameter, especially in Firefox and Safari. When using the "wmode" parameter set to "transparent," it can sometimes interfere with how the Flash control interacts with other HTML elements, leading to the need for an additiona...
1,664
[ { "from": "human", "value": "This page from Adobe says to add a \"wmode\" parameter and set its value to \"transparent\": http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_1420\nThis works flawlessly in IE. The background renders correctly in Firefox and Safari, however as soon as you use the br...
I have a custom control that implements IPostBackEventHandler. Some client-side events invoke __doPostBack(controlID, eventArgs). The control is implemented in two different user controls. In one control, RaisePostBackEvent is fired on the server-side when __doPostBack is invoked. In the other control, RaisePostBackEve...
When troubleshooting issues with `IPostBackEventHandler` and postback events not being raised in ASP.NET controls, there are several areas you can investigate: 1. **Check ViewState**: Ensure that the ViewState is enabled for both user controls. If ViewState is disabled, it could cause the server to not recognize the c...
1,907
[ { "from": "human", "value": "I have a custom control that implements IPostBackEventHandler. Some client-side events invoke __doPostBack(controlID, eventArgs).\nThe control is implemented in two different user controls. In one control, RaisePostBackEvent is fired on the server-side when __doPostBack is invok...
I'm creating an app that holds loads of loads of user data in memory, and it's mostly keeping it all in List<T> structures (and some Dictionary<T,T> when I need lookup). And I'm wondering... How efficient are Lists? How much memory overhead do I get for each of them? (that is, memory space in addition to what the objec...
Understanding the efficiency of collections in .NET, particularly `List<T>`, `Dictionary<TKey, TValue>`, and arrays, involves examining memory usage, time complexity, and performance characteristics. Let's break down your questions and concerns: ### 1. Efficiency of `List<T>` - **Memory Overhead:** `List<T>` has some...
321
[ { "from": "human", "value": "I'm creating an app that holds loads of loads of user data in memory, and it's mostly keeping it all in List<T> structures (and some Dictionary<T,T> when I need lookup).\nAnd I'm wondering...\nHow efficient are Lists?\nHow much memory overhead do I get for each of them? (that is...
What is the RegEx pattern for DateTime (2008-09-01 12:35:45 ) ? I get this error: No ending delimiter '^' found Using: preg_match('(?n:^(?=\d)((?<day>31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|0?[1-9]|1\d|2[0-8])(?<sep>[/.-])(?<mo...
The error you're encountering is due to improper syntax in your regular expression pattern. Specifically, you're using `(?n:` which is not a valid construct for starting a regex pattern. Also, you may need to adjust the delimiters around the pattern. Here’s a corrected version of a regular expression that matches the ...
3,532
[ { "from": "human", "value": "What is the RegEx pattern for DateTime (2008-09-01 12:35:45 ) ?\nI get this error:\n\nNo ending delimiter '^' found\n\nUsing:\npreg_match('(?n:^(?=\\d)((?<day>31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[357...
This caught my attention last night. On the latest ALT.NET Podcast Scott Bellware discusses how as opposed to Ruby, languages like C#, Java et al. are not truly object oriented rather opting for the phrase "class-oriented". They talk about this distinction in very vague terms without going into much detail or discussi...
The discussion around "object-oriented" versus "class-oriented" programming often hinges on the nature of how these languages implement and enforce their object-oriented principles. Here's a breakdown of these concepts, their implications, and some illustrative examples. ### Class-Oriented vs. Object-Oriented **Class...
1,760
[ { "from": "human", "value": "This caught my attention last night.\nOn the latest ALT.NET Podcast Scott Bellware discusses how as opposed to Ruby, languages like C#, Java et al. are not truly object oriented rather opting for the phrase \"class-oriented\". They talk about this distinction in very vague term...
Suppose that I have a form that contains three 10 fields: field1..field10. I store the form data in one or more database tables, probably using 10 database columns. Now suppose a few months later that I want to add 3 more fields. And in the future I may add/delete fields from this form based on changing requiremen...
Designing a data model that is loosely coupled from the UI and can accommodate dynamic changes in form fields, such as adding, removing, or modifying fields, can indeed help mitigate the maintenance headaches you mentioned. Here are a few approaches that can help you achieve this: ### 1. **Entity-Attribute-Value (EAV)...
1,531
[ { "from": "human", "value": "Suppose that I have a form that contains three 10 fields: field1..field10. I store the form data in one or more database tables, probably using 10 database columns. \nNow suppose a few months later that I want to add 3 more fields. And in the future I may add/delete fields f...
How could i implement Type-Safe Enumerations in Delphi in a COM scenario ? Basically, i'd like to replace a set of primitive constants of a enumeration with a set of static final object references encapsulated in a class ? . In Java, we can do something like: public final class Enum { public static final Enum ENUM...
In Delphi, especially in older versions like Delphi 5, you can implement type-safe enumerations using classes, as you suggested. This allows you to create an enumeration-like structure that restricts the values to predefined instances of a class, similar to how Java handles enums. Here's a way to implement type-safe en...
1,164
[ { "from": "human", "value": "How could i implement Type-Safe Enumerations in Delphi in a COM scenario ? Basically, i'd like to replace a set of primitive constants of a enumeration with a set of static final object references encapsulated in a class ? . \nIn Java, we can do something like:\npublic final cla...
Given a list of locations such as <td>El Cerrito, CA</td> <td>Corvallis, OR</td> <td>Morganton, NC</td> <td>New York, NY</td> <td>San Diego, CA</td> What's the easiest way to generate a Google Map with pushpins for each location?
To generate a Google Map with pushpins for a list of locations, you can use the Google Maps JavaScript API. Here’s a simple step-by-step guide to create a webpage that displays a Google Map with pushpins for each location: ### Step 1: Set Up Your HTML Page Create an HTML file (e.g., `map.html`) with the following con...
1,782
[ { "from": "human", "value": "Given a list of locations such as\n <td>El Cerrito, CA</td>\n <td>Corvallis, OR</td>\n <td>Morganton, NC</td>\n <td>New York, NY</td>\n <td>San Diego, CA</td>\n\nWhat's the easiest way to generate a Google Map with pushpins for each location?\n" }, { "from...
I use the jQuery extend function to extend a class prototype. For example: MyWidget = function(name_var) { this.init(name_var); } $.extend(MyWidget.prototype, { // object variables widget_name: '', init: function(widget_name) { // do initialization here this.widget_name = widget_name; }, d...
Yes, you can create a cleaner class definition in JavaScript using ES6 class syntax, which is more concise and modern compared to the jQuery extend method. It allows you to define a class and its methods in a more structured way, encapsulating the constructor and methods together in one statement. Here's how you can r...
4,349
[ { "from": "human", "value": "I use the jQuery extend function to extend a class prototype.\nFor example:\nMyWidget = function(name_var) {\n this.init(name_var);\n}\n\n$.extend(MyWidget.prototype, {\n // object variables\n widget_name: '',\n\n init: function(widget_name) {\n // do initialization h...
(This is a followup to my previous question about measuring .NET remoting traffic.) When I am testing our Windows service / service controller GUI combination, it is often most convenient to run both pieces on my development box. With this setup, the remoting traffic between the two is via loopback, not through the Eth...
Capturing loopback traffic on a Windows machine can indeed be a bit challenging since many packet sniffers do not support capturing loopback traffic directly. However, there are a few methods and tools you can use to capture .NET remoting traffic or other loopback traffic on Windows XP: 1. **Microsoft Message Analyzer...
2,945
[ { "from": "human", "value": "(This is a followup to my previous question about measuring .NET remoting traffic.)\nWhen I am testing our Windows service / service controller GUI combination, it is often most convenient to run both pieces on my development box. With this setup, the remoting traffic between th...
What is the difference between Build Solution and Batch Build in Visual Studio 2008?
In Visual Studio 2008, **Build Solution** and **Batch Build** are two different operations that manage how projects in a solution are built. Here are the main differences: ### Build Solution - **Definition**: This command compiles and links all the projects in the solution that have changed since the last build, along...
3,629
[ { "from": "human", "value": "What is the difference between Build Solution and Batch Build in Visual Studio 2008?\n" }, { "from": "gpt", "value": "In Visual Studio 2008, **Build Solution** and **Batch Build** are two different operations that manage how projects in a solution are built. Here are...
Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote up a method using the registry to try and determine whether or not the current system is a 32 or 64bit system. private Boolean is64BitOperatingSystem() { RegistryKey localEnvironment = Registry.LocalMachine.Open...
Accessing the registry to determine the operating system architecture is a common practice, but there are indeed better and more reliable methods to determine if a system is 32-bit or 64-bit in a Windows environment. The approach you've used is functional, but it may not account for all scenarios, such as systems runni...
3,975
[ { "from": "human", "value": "Since the WMI class Win32_OperatingSystem only includes OSArchitecture in Windows Vista, I quickly wrote up a method using the registry to try and determine whether or not the current system is a 32 or 64bit system.\nprivate Boolean is64BitOperatingSystem()\n{\n RegistryKey l...