instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am writing an application for Windows Mobile where I want to display some text over the video preview on the screen. Does anyone know how this could be done or if there's any good tutorial about it? Thanks!
Creating an application for Windows Mobile that displays text over a video preview involves working with the media and graphics APIs available in the Windows Mobile environment. Here's a general approach to achieve this: ### Steps to Display Text Over Video Preview in a Windows Mobile Application 1. **Set Up Your Dev...
48,643
[ { "from": "human", "value": "I am writing an application for Windows Mobile where I want to display some text over the video preview on the screen.\nDoes anyone know how this could be done or if there's any good tutorial about it?\nThanks!\n" }, { "from": "gpt", "value": "Creating an application...
Building on Getting Emacs to untabify when saving certain file types (and only those file types) , I'd like to run a hook to untabify my C++ files when I start modifying the buffer. I tried adding hooks to untabify the buffer on load, but then it untabifies all my writable files that are autoloaded when emacs starts. (...
To achieve the desired functionality in Emacs—untabifying your C++ files only when you start modifying them—you can use the `before-save-hook` to run the `untabify` function when you start editing the buffer. This way, you ensure that untabification only occurs for C++ files, and only when you're actually modifying the...
44,680
[ { "from": "human", "value": "Building on Getting Emacs to untabify when saving certain file types (and only those file types) , I'd like to run a hook to untabify my C++ files when I start modifying the buffer. I tried adding hooks to untabify the buffer on load, but then it untabifies all my writable files...
How do I create subdomains in ASP.NET? I have few links on my homepage(Home.aspx) Example: Link1 and Link2 I need to create two sub domains link1.example.com and link2.example.com and redirect to them. I will be using Response.Redirect for navigation. Questions: Do the files need to reside in different directory or s...
Creating subdomains in an ASP.NET application involves a few key steps, including configuring your web server (IIS) and managing routing in your ASP.NET application. Here’s a guide to help you through the process, addressing your specific questions along the way: ### 1. Subdomain Configuration **Do the files need to ...
49,958
[ { "from": "human", "value": "How do I create subdomains in ASP.NET? \nI have few links on my homepage(Home.aspx)\nExample: Link1 and Link2\nI need to create two sub domains link1.example.com and link2.example.com\nand redirect to them. I will be using Response.Redirect for navigation. \nQuestions:\nDo the f...
For my application, I want a Combo Box that displays its elements when dropped down as a Tree. Problem is, I'm not versed well enough in Swing to know how to go about doing this. At least without ending up writing a new widget from scratch, or something to that effect. How would I do something like this without creat...
Creating a ComboBox that displays its elements in a tree structure in Java Swing requires a bit of creativity, as the standard `JComboBox` does not support displaying its items in a tree format directly. However, you can achieve this by using a combination of a `JComboBox` and a `JTree`, or by customizing the behavior ...
45,035
[ { "from": "human", "value": "For my application, I want a Combo Box that displays its elements when dropped down as a Tree. Problem is, I'm not versed well enough in Swing to know how to go about doing this. At least without ending up writing a new widget from scratch, or something to that effect.\nHow wo...
I had a parametrized insert statement that was working well and I needed to add a select statement and wrap it all in a transaction in order to get data for one of the fields for the insert. I'm not sure if I've hit a limitation with ASP/ADO or if I've just got something syntactically wrong. Here's my code: set oSQLC...
The error you're encountering is indeed related to the SQL syntax and how you're trying to execute the SQL command in your ADO context. Here are a few points and a revised version of your code to address the issues: ### Issues Identified: 1. **Transaction Handling**: You need to ensure proper handling of transactions...
43,832
[ { "from": "human", "value": "I had a parametrized insert statement that was working well and I needed to add a select statement and wrap it all in a transaction in order to get data for one of the fields for the insert. I'm not sure if I've hit a limitation with ASP/ADO or if I've just got something syntac...
My aim is to convert a stream of byte code sent from an Alesis synthesizer to a human readable format. I need to be able to take a "Program Dump" and read the 10 character string that makes up the patch name. In order to receive the "Program Dump" from the synth, I sent the synth the following command via MIDI-OX: F0 ...
To convert the received MIDI program dump from the Alesis synthesizer into a human-readable format, you will need to extract and interpret the packed parameter data from the byte stream. 1. **Identify the relevant parts of the data**: Based on the received data structure, the program dump consists of a header, the pro...
49,425
[ { "from": "human", "value": "My aim is to convert a stream of byte code sent from an Alesis synthesizer to a human readable format. I need to be able to take a \"Program Dump\" and read the 10 character string that makes up the patch name.\nIn order to receive the \"Program Dump\" from the synth, I sent th...
Here is a simplified version of my application showing what I'm doing. /* in my app's main(): Runner run = new Runner(); run.dowork(); */ class Runner { private int totalWorkers = 2; private int workersDone = 0; public synchronized void workerDone() { workersDone++; notifyA...
The issue you're facing is related to how synchronization and communication between threads are set up in your code. Specifically, you're running into a deadlock situation because of the way you are managing the state and the synchronization of worker threads. Let's break down the key problems: 1. **Incorrect Use of `...
43,767
[ { "from": "human", "value": "Here is a simplified version of my application showing what I'm doing. \n/*\nin my app's main():\n\n Runner run = new Runner();\n\n run.dowork();\n\n*/\n\nclass Runner\n{\n private int totalWorkers = 2;\n private int workersDone = 0;\n\n public synchronized void w...
searchterms.rb search = "1|butter+salted|Butter salt|Butter|Túrós csusza|Margarine|Potato 2|butter+whipped|Shea butter|Butter|Pastry bag|Cream bun|Butter cream 3|butter+oil+anhydrous|Ultralight backpacking|Odell\'s|Ghee|Fragrance extraction|Perfume 4|cheese+blue|Blue cheese|Shropshire Blue...
It looks like you're trying to create a Ruby script to iterate over a list of food items, allow the user to select the most relevant term for each item, and then save those selections to a file. Based on the provided snippet and the errors you're encountering, let's go through the script to correct the issues. ### Iss...
43,754
[ { "from": "human", "value": "searchterms.rb\nsearch = \"1|butter+salted|Butter salt|Butter|Túrós csusza|Margarine|Potato\n 2|butter+whipped|Shea butter|Butter|Pastry bag|Cream bun|Butter cream\n 3|butter+oil+anhydrous|Ultralight backpacking|Odell\\'s|Ghee|Fragrance extraction|Perfume\n ...
I recently had to write some code which parsed a file to set data in an object. As there were several objects and corresponding files involved here, I decided to separate the parsing code out. So I then had one class for parsing the files, CommandFileParser, and two classes per file/object type: one for the actual obje...
Your situation with having separate command classes for each data class certainly raises some concerns about code duplication and unnecessary complexity. Here are some suggestions for a more elegant object-oriented approach to parsing your files and setting data in your objects: ### 1. **Command Pattern with a Single ...
49,399
[ { "from": "human", "value": "I recently had to write some code which parsed a file to set data in an object. As there were several objects and corresponding files involved here, I decided to separate the parsing code out.\nSo I then had one class for parsing the files, CommandFileParser, and two classes per...
here is my example code: Public Class Parent Private _TestProperty As String Private WithEvents _Child As IList(Of Child) Public Property Test() As String Get Return _TestProperty End Get Set(ByVal value As String) _TestProperty = value End Set En...
To handle events raised by individual children in your `Parent` class, you will need to attach event handlers to each `Child` object when you add it to the `_Child` list. Since you are using `IList(Of Child)`, you cannot use `WithEvents` directly on the list itself, as `WithEvents` can only be applied to a single objec...
33,550
[ { "from": "human", "value": "here is my example code:\nPublic Class Parent\n Private _TestProperty As String\n Private WithEvents _Child As IList(Of Child)\n\n Public Property Test() As String\n Get\n Return _TestProperty\n End Get\n Set(ByVal value As String)\n ...
I'm looking for digital low pass filter code/library/class for a .net windows forms project, preferably written in c, c++ or c#. I probably need to set the number of poles, coefficients, windowing, that sort of thing. I can't use any of the gpl'd code that's available, and don't know what else is out there. Any suggest...
Creating a digital low-pass filter from scratch can
41,180
[ { "from": "human", "value": "I'm looking for digital low pass filter code/library/class for a .net windows forms project, preferably written in c, c++ or c#. I probably need to set the number of poles, coefficients, windowing, that sort of thing. I can't use any of the gpl'd code that's available, and don't...
I know that lots of web hosting providers are offering FreeBSD, but how good is FreeBSD as a development platform? Specifically, is Java 1.6 available in it? Is there somthing specific that it offers with regard to tools that is not available under Linux?
FreeBSD is a well-regarded operating system that is known for its stability, performance, and advanced networking features. It is often chosen for server environments, but it can also be a good development platform, depending on your needs. Here are some key considerations regarding FreeBSD as a development platform: ...
39,253
[ { "from": "human", "value": "I know that lots of web hosting providers are offering FreeBSD, but how good is FreeBSD as a development platform?\nSpecifically, is Java 1.6 available in it? \nIs there somthing specific that it offers with regard to tools that is not available under Linux?\n" }, { "fro...
In eclipse developing a java app, there are several class files that are generated by a custom ant script. This happens automatically, and it is set up as an export/publish dependency for /WEB-INF/classes. With publishing it happens alright, however on exporting to .WAR these files just got missing. Is there a way to...
To automate the inclusion of class files generated by your custom Ant script when exporting a .WAR file in Eclipse, you have several options. Here’s a step-by-step approach to ensure your generated class files are included in the WAR file when you export your project: ### 1. Modify the Ant Script First, ensure that y...
37,264
[ { "from": "human", "value": "In eclipse developing a java app, there are several class files that are generated by a custom ant script. This happens automatically, and it is set up as an export/publish dependency for /WEB-INF/classes. \nWith publishing it happens alright, however on exporting to .WAR these ...
I'm trying to call my good old 'RegisterClientScriptBlock' on the friendly 'ScriptManager' class. It just doesn't work for my CompositeControl? I use it on a normal usercontrol (ascx) where it works. Visual Studio simply won't accept me typing 'ScriptManager' or i get "The name 'ScriptManager' does not exist in the cur...
The issue you're encountering is indeed related to the context in which you're trying to
40,960
[ { "from": "human", "value": "I'm trying to call my good old 'RegisterClientScriptBlock' on the friendly 'ScriptManager' class.\nIt just doesn't work for my CompositeControl? I use it on a normal usercontrol (ascx) where it works.\nVisual Studio simply won't accept me typing 'ScriptManager' or i get \"The na...
In my Seam application, I have a Seam component that returns a (@Datamodel) list of items I want to transform into a set of <li> HTML elements. I have this working without a problem. But now, I want to split up the list according to an EL expression. So the EL expression determines if a new <ul> element should be star...
To handle this situation correctly in your Seam application while using JSF, you need to ensure that the opening and closing `<ul>` tags are properly nested around the `<li>` elements based on your EL expression. The issue arises because you cannot open a `<ul>` in one `<s:fragment>` and close it in another. Instead, y...
39,033
[ { "from": "human", "value": "In my Seam application, I have a Seam component that returns a (@Datamodel) list of items I want to transform into a set of <li> HTML elements. I have this working without a problem. \nBut now, I want to split up the list according to an EL expression. So the EL expression deter...
Which is the best method to make the browser use cached versions of js files (from the serverside)?
To ensure that browsers effectively use cached versions of JavaScript files, there are several methods you can implement from the server side. Here are some of the best practices: ### 1. HTTP Caching Headers Utilize HTTP caching headers to control how browsers cache your JavaScript files: - **Cache-Control:** This h...
37,582
[ { "from": "human", "value": "Which is the best method to make the browser use cached versions of js files (from the serverside)?\n" }, { "from": "gpt", "value": "To ensure that browsers effectively use cached versions of JavaScript files, there are several methods you can implement from the serv...
My current code looks like the following. How can I pass my array to the controller and what kind of parameters must my controller action accept? function getplaceholders() { var placeholders = $('.ui-sortable'); var result = new Array(); placeholders.each(function() { var ph = $(this).attr('id'); ...
To successfully pass your array of objects to your controller action method in ASP.NET MVC, you need to ensure that the structure of the data you're sending from your JavaScript matches the expected structure in your controller action. ### Changes Needed 1. **Data Format**: The data should be serialized in a way that...
38,428
[ { "from": "human", "value": "My current code looks like the following. How can I pass my array to the controller and what kind of parameters must my controller action accept?\nfunction getplaceholders() {\n var placeholders = $('.ui-sortable');\n var result = new Array();\n placeholders.each(functi...
Suppose you have the canonical Customer domain object. You have three different screens on which Customer is displayed: External Admin, Internal Admin, and Update Account. Suppose further that each screen displays only a subset of all of the data contained in the Customer object. The problem is: when the UI passes dat...
You’re facing a common issue when dealing with partial updates and Data Transfer Objects (DTOs) in the context of domain models. Here are some ideas that could help address the problem while maintaining the integrity of your Customer entity: ### 1. **Use a Merge Method**: Implement a merge or patch method in your Cust...
37,246
[ { "from": "human", "value": "Suppose you have the canonical Customer domain object. You have three different screens on which Customer is displayed: External Admin, Internal Admin, and Update Account.\nSuppose further that each screen displays only a subset of all of the data contained in the Customer objec...
I'm looking for an XML editor that lets me type and copy and paste arbitrary text into an XML element or attribute without requiring me to go back through and escape any characters that must use reserved XML entities (ampersands, angle brackets, or quote marks). XMLSpy came up short.
If you're looking for an XML editor that allows you to paste arbitrary text into elements or attributes without the need to manually escape reserved characters, here are some options you might consider: 1. **Notepad++ with XML Tools Plugin**: - Notepad++ is a lightweight text editor that supports many languages and...
40,623
[ { "from": "human", "value": "I'm looking for an XML editor that lets me type and copy and paste arbitrary text into an XML element or attribute without requiring me to go back through and escape any characters that must use reserved XML entities (ampersands, angle brackets, or quote marks). XMLSpy came up s...
When I get AuthenticationStatus.Authenticated (DotNetOpenId library) response from myopenid provider, i'd like to redirect user from login page to another one using MVC Redirect(myurl). But unfortunately, instead of getting to myurl, user is redirected to empty page: myurl?token=AWSe9PSLwx0RnymcW0q.... (+ several kilob...
When working with OpenID authentication using the DotNetOpenId library in an MVC application, handling the redirection after successful authentication can be tricky. Here's how you can properly redirect the user to your desired URL without getting stuck on an empty page or being redirected back to the login page. ### ...
39,694
[ { "from": "human", "value": "When I get AuthenticationStatus.Authenticated (DotNetOpenId library)\nresponse from myopenid provider, i'd like to redirect user from login page\nto another one using MVC Redirect(myurl). But unfortunately, instead of\ngetting to myurl, user is redirected to empty page:\nmyurl?t...
I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed a JDBC SQLite driver from zentus.com and added a new driver in Nebeans services panel. Then tried to connect to my database file from Services > Databases using this URL for my database: jdbc:sqlite:/home/farzad/netbeans/myproject/mydb.sqlite but i...
It looks like you're trying to connect to a SQLite database using an older version of the JDBC driver, and there may be some configuration or compatibility issues. Here are a few steps to troubleshoot and potentially resolve your issue: 1. **Check JDBC Driver Compatibility**: Ensure that the version of the JDBC dri...
40,438
[ { "from": "human", "value": "I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed a JDBC SQLite driver from zentus.com and added a new driver in Nebeans services panel. Then tried to connect to my database file from Services > Databases using this URL for my database: \njdbc:sqlite:/home/f...
I have a problem where I am attempting to update a set of attributes with a fixed value contained within a repeating section of an XML document using the Microsoft.BizTalk.Streaming.ValueMutator. For example the XML document which I am attempting to update contains the following input: <ns0:TestXML xmlns:ns0="http://T...
The issue you're encountering arises because you are trying to update the text content of the `<ns0:alpha>`
41,846
[ { "from": "human", "value": "I have a problem where I am attempting to update a set of attributes with a fixed value contained within a repeating section of an XML document using the Microsoft.BizTalk.Streaming.ValueMutator. \nFor example the XML document which I am attempting to update contains the followi...
Is it possible to set some image as title of Navigation bar? I think NYTimes application used a Navigation bar and title is look like image file (the reason why it's seems UINavigationBar is because they use right button to search).
Yes, it is possible to set an image as the title of a navigation bar in a UIKit application. While a `UINavigationBar` typically displays a title as a `UILabel`, you can customize it to show an image instead. Here’s how you can do it: ### Method 1: Using `titleView` of `UINavigationItem` You can set a custom view for...
39,319
[ { "from": "human", "value": "Is it possible to set some image as title of Navigation bar?\nI think NYTimes application used a Navigation bar and title is look like image file (the reason why it's seems UINavigationBar is because they use right button to search).\n" }, { "from": "gpt", "value": "...
I was wondering if there was a simple way to use WMI to get you the current windows user name with domain. The Windows API call just gets you the short username, so you end up doing another call for the domain name. I have some code, but I get an automation error. Any ideas? I think I'm on the right path, but I am a li...
It looks like you're on the right track with using WMI to get the current Windows user name along with the domain. However, there are a couple of things to keep in mind, especially regarding error handling and ensuring the `GetOwner` method is used correctly. Here's a slightly modified version of your function that s...
38,578
[ { "from": "human", "value": "I was wondering if there was a simple way to use WMI to get you the current windows user name with domain. The Windows API call just gets you the short username, so you end up doing another call for the domain name. I have some code, but I get an automation error.\nAny ideas? I ...
I have a class ReportingComponent<T>, which has the constructor: public ReportingComponent(IQueryable<T> query) {} I have Linq Query against the Northwind Database, var query = context.Order_Details.Select(a => new { a.OrderID, a.Product.ProductName, a.Order.OrderDate }); Query is of type IQueryable<a...
In C#, generic types must be instantiated with a specific type, and anonymous types do not have a named type that
41,870
[ { "from": "human", "value": "I have a class ReportingComponent<T>, which has the constructor: \npublic ReportingComponent(IQueryable<T> query) {}\n\nI have Linq Query against the Northwind Database,\nvar query = context.Order_Details.Select(a => new \n{ \n a.OrderID, \n a.Product.ProductName,\n a.O...
When C# 4.0 comes out and we have the dynamic keyword as described in this excellent presentation by Anders Hejlsberg, (C# is evolving faster than I can keep up.. I didn't have much time to acquaint myself with the var keyword) Would I still need the var keyword ? Is there anything that var can do.. that dynamic can't?...
In C# 4.0, both `var` and `dynamic` serve different purposes, and each has its own advantages and use cases. Here are the key differences between them: ### `var` Keyword - **Type Inference**: The `var` keyword is used for type inference when declaring variables. The type of the variable is determined at compile-time b...
39,705
[ { "from": "human", "value": "When C# 4.0 comes out and we have the dynamic keyword as described in this excellent presentation by Anders Hejlsberg, (C# is evolving faster than I can keep up.. I didn't have much time to acquaint myself with the var keyword)\nWould I still need the var keyword ? Is there anyt...
Hey all. We're sending quite a few emails (around 23k) using IIS6 SMTP service and receive about 7-8 error messages each time. The stack trace is: System.Net.Mail.SmtpException: Exceeded storage allocation. The server response was: 4.3.1 Session size exceeds fixed maximum session size at System.Net.Mail.DataStopCo...
Hi Jim, The error message you're receiving, "Exceeded storage allocation. The server response was: 4.3.1 Session size exceeds fixed maximum session size," indicates that you are hitting the limit set on the session size for the SMTP service. Here’s a breakdown of what you can do: ### Understanding the Limits: 1. **Me...
38,351
[ { "from": "human", "value": "Hey all. We're sending quite a few emails (around 23k) using IIS6 SMTP service and receive about 7-8 error messages each time. The stack trace is:\nSystem.Net.Mail.SmtpException: Exceeded storage allocation. The server response was: 4.3.1 Session size exceeds fixed maximum ses...
I am looking for any best practices or ideas on how you would create an interface with a DB from a .NET web application to upload data from Excel files Should I use a mechanism that allows all the records to be loaded and flags the errors or should I use a mechanism that stops the load when an error occurs. I've never ...
Creating an interface that allows users to upload data from Excel files to a database in a .NET web application is a
41,864
[ { "from": "human", "value": "I am looking for any best practices or ideas on how you would create an interface with a DB from a .NET web application to upload data from Excel files\nShould I use a mechanism that allows all the records to be loaded and flags the errors or should I use a mechanism that stops ...
For the better part of 10 years + we have relied on various network mapped drives to allow file sharing. One drive letter for sharing files between teams, a seperate file share for the entire organization, a third for personal use etc. I would like to move away from this and am trying to decide if an ECM/Sharepoint t...
Transitioning from a traditional file sharing setup using mapped drives to a more modern solution like an Enterprise Content Management (ECM) system or SharePoint can bring several benefits, but it also requires careful consideration of your organization's needs, culture, and resources. Here are some factors to conside...
39,651
[ { "from": "human", "value": "For the better part of 10 years + we have relied on various network mapped drives to allow file sharing. One drive letter for sharing files between teams, a seperate file share for the entire organization, a third for personal use etc. I would like to move away from this and a...
I have a Gridview boundfield where i set ReadOnly to true because i don't want user to change its value. However on the objectdatasource control's update method that boundfield became null when i try to use it as parameter in update method. Is there a way to set that value during updating?
When you're using a `GridView` with `BoundField` set to `ReadOnly`, it will not
41,904
[ { "from": "human", "value": "I have a Gridview boundfield where i set ReadOnly to true because i don't want user to change its value. However on the objectdatasource control's update method that boundfield became null when i try to use it as parameter in update method. Is there a way to set that value durin...
I'm working on a small project to help me tag content on Flickr. I've been looking through the API and there's obvious ways to search for tagged content, but not a simple way of finding what content hasn't been tagged (without just looping through image ID's till I find one with no tag). Has anyone come across this in ...
Finding untagged content on Flickr can be a bit challenging since the API primarily focuses on searching and retrieving content based on tags. However, you can approach this problem in a couple of ways, even though it may require some additional steps: ### 1. **Retrieve All Photos and Filter Locally** You can use the ...
39,942
[ { "from": "human", "value": "I'm working on a small project to help me tag content on Flickr.\nI've been looking through the API and there's obvious ways to search for tagged content, but not a simple way of finding what content hasn't been tagged (without just looping through image ID's till I find one wit...
I am working on implementing Zend Framework within an existing project that has a public marketing area, a private members area, an administration site, and a marketing campaign management site. Currently these are poorly organized with the controller scripts for the marketing area and the members area all being under ...
To implement Zend Framework with a modular architecture while sharing the same models across multiple modules, you can follow these steps. Below is a high-level overview of the process, along with code snippets and instructions to guide you. ### 1. Setting Up Your Module Structure First, you'll want to create a folde...
36,887
[ { "from": "human", "value": "I am working on implementing Zend Framework within an existing project that has a public marketing area, a private members area, an administration site, and a marketing campaign management site. Currently these are poorly organized with the controller scripts for the marketing a...
The documentation says that CSimpleArray is for dealing with small numbers of objects. What is small in this context? Is CSimpleArray ever a good choice or should I always use a different collection class such as CAtlArray?
In the context of `CSimpleArray`, "small numbers of objects" typically refers to a limited number of elements where performance overhead and memory consumption are critical factors. While there is no strict definition of what constitutes "small," it is generally considered to be in the range of tens to a few hundreds o...
40,077
[ { "from": "human", "value": "The documentation says that CSimpleArray is for dealing with small numbers of objects. What is small in this context? Is CSimpleArray ever a good choice or should I always use a different collection class such as CAtlArray?\n" }, { "from": "gpt", "value": "In the con...
I have a circular, statically allocated buffer in C, which I'm using as a queue for a depth breadth first search. I'd like have the top N elements in the queue sorted. It would be easy to just use a regular qsort() - except it's a circular buffer, and the top N elements might wrap around. I could, of course, write my o...
Given your requirements, it seems that you want to effectively manage a circular buffer while adding a sorting mechanism for a limited number of recently expanded states in your BFS algorithm. Here’s a concise plan to accomplish this task with minimal complexity and efficient use of space: ### Suggested Approach 1. *...
38,495
[ { "from": "human", "value": "I have a circular, statically allocated buffer in C, which I'm using as a queue for a depth breadth first search. I'd like have the top N elements in the queue sorted. It would be easy to just use a regular qsort() - except it's a circular buffer, and the top N elements might wr...
I've inherited a web app that I've just discovered stores over 300,000 usernames/passwords in plain text in a SQL Server database. I realize that this is a Very Bad Thing™. Knowing that I'll have to update the login and password update processes to encrypt/decrypt, and with the smallest impact on the rest of the syste...
You're correct in identifying that storing passwords in plain text is a significant security issue that needs to be addressed as soon as possible. Your proposed procedure is on the right track, but I'd like to add some specific steps and considerations to help ensure a smooth and secure transition. Here’s a comprehensi...
40,533
[ { "from": "human", "value": "I've inherited a web app that I've just discovered stores over 300,000 usernames/passwords in plain text in a SQL Server database. I realize that this is a Very Bad Thing™.\nKnowing that I'll have to update the login and password update processes to encrypt/decrypt, and with th...
I have a website cgi-bin program that is written in c++. Unfortunately the website provider for my friend's site only allows Perl or PHP cgi-bin scripts. Is there an easy way to simply have a very small Perl or PHP wrapper that just calls the c++ compiled binary? Would the c++ program still be able to read from stdin...
Yes, you can create a simple Perl or PHP wrapper that calls your C++ compiled binary. Here’s a brief overview of how to do it for both languages: ### Perl Wrapper You can create a Perl CGI script that uses `open()` to call your C++ binary and handles input and output. Here's an example: ```perl #!/usr/bin/perl use ...
38,567
[ { "from": "human", "value": "I have a website cgi-bin program that is written in c++. \nUnfortunately the website provider for my friend's site only allows Perl or PHP cgi-bin scripts.\nIs there an easy way to simply have a very small Perl or PHP wrapper that just calls the c++ compiled binary? \nWould the ...
I have an initialization class that preloads content into a variable (probably a list or array). There will only be one instance of this initialization class but there will be many classes that need to access the preloaded content. The problem is not many of them are related and none of them extend my initialization c...
Your approach of using a static method and variable in a singleton-like initialization class is quite common for preloading shared resources. However, it can become less manageable as the application grows, especially if the static state becomes complex or needs more control over access patterns. Here are a few altern...
38,135
[ { "from": "human", "value": "I have an initialization class that preloads content into a variable (probably a list or array). There will only be one instance of this initialization class but there will be many classes that need to access the preloaded content.\nThe problem is not many of them are related a...
I am going to spend 30 minutes teaching Perl to an experienced programmer. The best way to learn Perl is by writing code. In addition to CPAN, what would you show a programmer so they would understand the expressiveness of Perl, the amount of functionality provided by CPAN, while keeping everything clean and tidy so ...
Your outline looks great and serves as a good starting point for teaching Perl to an experienced programmer. Here’s a refined approach with a focus on demonstrating the expressiveness of Perl, highlighting CPAN functionality, and maintaining a tidy structure. This way, you can show the language’s features through pract...
38,100
[ { "from": "human", "value": "I am going to spend 30 minutes teaching Perl to an experienced programmer. The best way to learn Perl is by writing code. In addition to CPAN, what would you show a programmer so they would understand the expressiveness of Perl, the amount of functionality provided by CPAN, wh...
I'm trying to do something like URL clientks = com.messaging.SubscriptionManager.class.getResource( "client.ks" ); String path = clientks.toURI().getPath(); System.setProperty( "javax.net.ssl.keyStore", path); Where client.ks is a file stored in com/messaging in the jar file that I'm running. The thing that reads the...
When working with files in a JAR, you have to remember that the files inside a JAR are not accessible as regular file paths on the filesystem because they are packaged inside the JAR file. Therefore,
41,572
[ { "from": "human", "value": "I'm trying to do something like \nURL clientks = com.messaging.SubscriptionManager.class.getResource( \"client.ks\" );\nString path = clientks.toURI().getPath();\nSystem.setProperty( \"javax.net.ssl.keyStore\", path);\n\nWhere client.ks is a file stored in com/messaging in the j...
I've got a text file that contains several 'records' inside of it. Each record contains a name and a collection of numbers as data. I'm trying to build a class that will read through the file, present only the names of all the records, and then allow the user to select which record data he/she wants. The first time I...
In .NET, reading a large file while efficiently capturing the position of each record can be accomplished by utilizing the `FileStream` class in combination with a `StreamReader`. The `FileStream` allows you to seek to specific positions in the file, and you can use a `StreamReader` to read lines from that position. Be...
40,579
[ { "from": "human", "value": "I've got a text file that contains several 'records' inside of it. Each record contains a name and a collection of numbers as data. \nI'm trying to build a class that will read through the file, present only the names of all the records, and then allow the user to select which r...
I am trying to create an instance of a COM object. I have the class name that implements the interface and I get a CLSID by using CLSIDFromProgID(). So since I am getting a CLSID I thought everything should be fine from now on. However when I do a call to CreateInstance and pass in the CLSID, I get an error saying "Cla...
When you encounter a "Class not registered" error when trying to create an instance of a COM object, there are several possible reasons for this, especially given that it works on some computers and not others. Here are several things to consider that could help you diagnose and fix the issue: ### 1. **
41,604
[ { "from": "human", "value": "I am trying to create an instance of a COM object. I have the class name that implements the interface and I get a CLSID by using CLSIDFromProgID(). So since I am getting a CLSID I thought everything should be fine from now on. However when I do a call to CreateInstance and pass...
I have two tables with the same columns, and I need to copy one table's rows to the other table's rows to create one big table with all the values from both tables. Right now I am doing this query to return the same thing: SELECT col1, col2, col3 from Table1 union SELECT col1, col2, col3 from Table2 However, it seems...
Using `UN
42,300
[ { "from": "human", "value": "I have two tables with the same columns, and I need to copy one table's rows to the other table's rows to create one big table with all the values from both tables. Right now I am doing this query to return the same thing:\nSELECT col1, col2, col3 from Table1\nunion\nSELECT col...
I'm writing a simple time tracking program to manage my own projects. I'm a big fan of keeping reporting code in the database, so I've been attempting to create a few sprocs that generate the invoices and timesheets etc. I have a table that contains Clock Actions, IE "Punch In", and "Punch Out". It also contains the us...
To achieve the result set you want, you can use a Common Table Expression (CTE) combined with a simple aggregation and join. The general idea is to pair each "Clock In" with its corresponding "Clock Out" and then calculate the total time spent. Here’s a SQL query that demonstrates how you can do this: ```sql WITH CTE...
39,007
[ { "from": "human", "value": "I'm writing a simple time tracking program to manage my own projects. I'm a big fan of keeping reporting code in the database, so I've been attempting to create a few sprocs that generate the invoices and timesheets etc.\nI have a table that contains Clock Actions, IE \"Punch In...
i am writing a 2d lib which will have 3d acceleration but i'd like to do it in a way that it will efficiently run on older HW. Possibly typedefs to hide options/functions that your targeted mode does not support. (also there may be emulation func turned on) What are some of the things older HW do? here is a list of que...
It's great that you're considering the capabilities of older hardware while designing your 2D library with 3D acceleration. Below is a more comprehensive list of considerations and potential features to take into account when targeting older hardware. ### Hardware Considerations 1. **Tile-based Rendering:** - Whil...
40,766
[ { "from": "human", "value": "i am writing a 2d lib which will have 3d acceleration but i'd like to do it in a way that it will efficiently run on older HW. Possibly typedefs to hide options/functions that your targeted mode does not support. (also there may be emulation func turned on)\nWhat are some of the...
With Php when does an included file get included? Is it during a preprocessing stage or is it during script evaluation? Right now I have several scripts that share the same header and footer code, which do input validation and exception handling. Like this: /* validate input */ ... /* process/do task */ ... /* handle e...
In PHP, when you use `include` or `require`, the file is included during the script evaluation phase, not as a preprocessing step. This means that if an exception occurs before the `include` statement is executed, the included file won't run, and your script will terminate. Since your use case involves input validatio...
40,847
[ { "from": "human", "value": "With Php when does an included file get included? Is it during a preprocessing stage or is it during script evaluation?\nRight now I have several scripts that share the same header and footer code, which do input validation and exception handling. Like this:\n/* validate input *...
I am working on a project and trying to determine what platform to use. Right now, my first choice would be to use ASP.Net MVC with a MySql database. My concern with this is that the MySql drivers have a GPL license. I am creating this for a company and therefore it can't be an open-source project. Here are the questio...
Here are the answers to your questions regarding the use of MySQL, PostgreSQL, and hosting considerations for your project. ### 1. MySQL and GPL License If you use MySQL's official drivers (Connector/Net) which are licensed under the GPL, it does indeed impose certain restrictions. The GPL
41,625
[ { "from": "human", "value": "I am working on a project and trying to determine what platform to use. Right now, my first choice would be to use ASP.Net MVC with a MySql database. My concern with this is that the MySql drivers have a GPL license. I am creating this for a company and therefore it can't be an ...
Is there a way (a program, a library) to approximately know which language a document is written in? I have a bunch of text documents (~500K) in mixed languages to import in a i18n enabled CMS (Drupal).. I don't need perfect matches, only some guess.
Yes, there are several libraries and tools that can help you detect the language of a document with a reasonable degree of accuracy. Here are a few popular options: ### Libraries 1. **Langdetect**: - Language detection library in Python, based on Google's language-detection library. - Easy to use for detecting ...
40,630
[ { "from": "human", "value": "Is there a way (a program, a library) to approximately know which language a document is written in?\nI have a bunch of text documents (~500K) in mixed languages to import in a i18n enabled CMS (Drupal)..\nI don't need perfect matches, only some guess.\n" }, { "from": "g...
I have a block of JSP code that needs to be used in several places (basically a widget that several pages use). What's a good way to modularize this? I'd rather not put it in an object since string manipulation of HTML gets ugly. Using <%@ include file="foo.jsp"%> is problematic because we wind up having implicit globa...
To modularize your JSP code while avoiding the downsides of implicit global variables and making the code reusable across multiple pages, you can consider the following approaches: ### 1. **Using Custom JSP Tags** Creating custom tags allows you to encapsulate your JSP code and make it reusable without polluting the J...
39,560
[ { "from": "human", "value": "I have a block of JSP code that needs to be used in several places (basically a widget that several pages use). What's a good way to modularize this? I'd rather not put it in an object since string manipulation of HTML gets ugly. Using <%@ include file=\"foo.jsp\"%> is problemat...
I added the columns in the select list to the order by list, but it is still giving me the error: ORDER BY items must appear in the select list if SELECT DISTINCT is specified. Here is the stored proc: CREATE PROCEDURE [dbo].[GetRadioServiceCodesINGroup] @RadioServiceGroup nvarchar(1000) = NULL AS BEGIN SET NOCOUNT ON...
The error you're encountering indicates that when using `SELECT DISTINCT`, all the columns referenced in the `ORDER BY` clause must also be included in the `SELECT` list. In your query, you're trying to order by `rsc.RadioServiceCode`, `rsc.RadioServiceCodeId`, and `rsc.RadioService`, but you're only selecting `rsc.Rad...
40,421
[ { "from": "human", "value": "I added the columns in the select list to the order by list, but it is still giving me the error:\nORDER BY items must appear in the select list if SELECT DISTINCT is specified.\nHere is the stored proc:\nCREATE PROCEDURE [dbo].[GetRadioServiceCodesINGroup] \n@RadioServiceGroup ...
Emacs does not recognize my correct Python path. I think it is a general problem with Emacs not recognizing my environment variables. I have GNU Emacs 22.1.1 (i386-apple-darwin8.9.1, Carbon Version 1.6.0) of 2007-06-17 installed. I have set PYTHONPATH in my ~/.bashrc. Maybe I should set it somewhere else?
Emacs may not be recognizing your environment variables because it may not be started in a shell environment that sources your `~/.bashrc`. In many cases, graphical applications like Emacs might not run in the same shell session as your terminal, which can lead to them not inheriting certain environment variables that ...
38,992
[ { "from": "human", "value": "Emacs does not recognize my correct Python path. I think it is a general problem with Emacs not recognizing my environment variables. I have GNU Emacs 22.1.1 (i386-apple-darwin8.9.1, Carbon Version 1.6.0) of 2007-06-17 installed.\nI have set PYTHONPATH in my ~/.bashrc. Maybe I s...
I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch, without any console window displayed, with all arguments passed to the invisible batch. The first batch is executed in a console window. However, I do...
Certainly! If you want to launch a batch file from another batch file without displaying a console window and passing all arguments, your approach using VBScript is a good choice. Here's a summary of how you can achieve this using VBScript, along with an example. ### Method: Using VBScript You can create a VBScript t...
40,225
[ { "from": "human", "value": "I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch:\n\nfrom another batch,\nwithout any console window displayed,\nwith all arguments passed to the invisible batch.\n\nThe first batch...
Is it possible to fetch the current application version programmatically for use in urls with far future expires header? For example: <link rel="stylesheet" href="app.js?v=1.23" /> Should be automatically updated to: <link rel="stylesheet" href="app.js?v=1.24" /> In order to do so I need to get the version.
Yes, you can fetch the current application version programmatically for use in URLs by integrating version management into your build process. There are several approaches you can use depending on your stack and requirements. Here are a few common methods: ### 1. Using a Build Tool If you're using a build tool like We...
38,974
[ { "from": "human", "value": "Is it possible to fetch the current application version programmatically for use in urls with far future expires header?\nFor example:\n<link rel=\"stylesheet\" href=\"app.js?v=1.23\" />\n\nShould be automatically updated to:\n<link rel=\"stylesheet\" href=\"app.js?v=1.24\" />\n...
Python has a number of soap stacks; as near as I can tell, all have substantial defects. Has anyone had luck consuming and using WSDL for S3, EC2, and SQS in python? My experience is that suds fails when constructing a Client object; after some wrangling, ZSI generates client code that doesn't work; etc. Finally, I'm a...
As of my last knowledge update in October 2023, AWS primarily provides RESTful APIs and SDKs (like Boto3) for accessing its services such as S3, EC2, and SQS. SOAP is not widely used in AWS services, and while there may be WSDL definitions for some services, they are often outdated or not as well-maintained as the REST...
40,246
[ { "from": "human", "value": "Python has a number of soap stacks; as near as I can tell, all have substantial defects.\nHas anyone had luck consuming and using WSDL for S3, EC2, and SQS in python?\nMy experience is that suds fails when constructing a Client object; after some wrangling, ZSI generates client ...
I recently discovered Powershell and through that PSake. If you are using it and you've extended it or created tasks for it, please share!
PSake is a build automation tool written in PowerShell that is simple yet powerful. It allows you to define build tasks in a straightforward way, making it easier to manage complex build processes. Below are some examples of how to extend PSake and create custom tasks. ### Basic Structure of a PSake Build Script A PS...
36,270
[ { "from": "human", "value": "I recently discovered Powershell and through that PSake. If you are using it and you've extended it or created tasks for it, please share!\n" }, { "from": "gpt", "value": "PSake is a build automation tool written in PowerShell that is simple yet powerful. It allows y...
I need to configure Tomcat 5.5.27 for disabling weak ciphers, ServerSignature and AuthType but I am unable to find the httpd.conf file. Please let me know about this. Thanks in advance..
Tomcat is a Java-based application server and does not use an `httpd.conf` file, which is specific to Apache HTTP Server (httpd). However, you can configure SSL and other security settings in Tomcat's configuration files. Here’s how to configure Tomcat 5.5.27 to disable weak ciphers, set `ServerSignature`, and manage ...
38,466
[ { "from": "human", "value": "I need to configure Tomcat 5.5.27 for disabling weak ciphers, ServerSignature and AuthType but I am unable to find the httpd.conf file. Please let me know about this.\nThanks in advance..\n" }, { "from": "gpt", "value": "Tomcat is a Java-based application server and ...
Are there any guidelines/best practices for deciding what type of data should be stored in the database? For ex., is it ok to use database to store Application logs Configuration details (like server IP addresses etc.) System information (e.g., names of shell scripts, scheduling information for batch jobs, batch jobs...
When deciding what type of data should be stored in a database, it's important to consider factors such as access patterns, data durability, consistency requirements, retrieval speed, and the nature of the data itself. Below are some guidelines and best practices, as well as a discussion of using databases to store app...
37,926
[ { "from": "human", "value": "Are there any guidelines/best practices for deciding what type of data should be stored in the database?\nFor ex., is it ok to use database to store\n\nApplication logs \nConfiguration details (like server IP addresses etc.)\nSystem information (e.g., names of shell scripts, sch...
I'm writing an application that can be started either as a standard WinForms app or in unattended mode from the command-line. The application was built using the VS 2k5 standard WinForms template. When the application is executed from the command-line, I want it to output information that can be captured by the script ...
To allow a WinForms application to write output to the console when executed from the command line (without creating a new console window using `AllocConsole`), you have a couple of options. Since a standard WinForms application does not create a console by default, the output of `Console.WriteLine()` will not appear...
40,231
[ { "from": "human", "value": "I'm writing an application that can be started either as a standard WinForms app or in unattended mode from the command-line. The application was built using the VS 2k5 standard WinForms template.\nWhen the application is executed from the command-line, I want it to output infor...
How can we implement the Builder pattern of Joshua's Effective Java in C#? Below is the code I have tried, is there a better way to do this? public class NutritionFacts { public static NutritionFacts.Builder Build(string name, int servingSize, int servingsPerContainer) { return new...
The Builder pattern is a great way to construct complex objects step-by-step while keeping your code clean and maintainable. Your initial implementation is a good start, but there are a few improvements that can be made to enhance it and facilitate extensibility. 1. **Using Fluent Interfaces**: You can return `this` i...
36,410
[ { "from": "human", "value": "\nHow can we implement the Builder\npattern of Joshua's\nEffective Java in C#?\n\nBelow is the code I have tried, is there a better way to do this?\n public class NutritionFacts\n {\n public static NutritionFacts.Builder Build(string name, int servingSize, int servi...
When implementing the ViewModel in a Model-View-ViewModel architecture WPF application there seem to be two major choices how to make it databindable. I have seen implementations that use DependencyProperty for properties the View is going to bind against and I have seen the ViewModel implementing INotifyPropertyChange...
When working with the Model-View-ViewModel (MVVM) pattern in WPF applications, the choice between using **DependencyProperties** and implementing **INotifyPropertyChanged** in your ViewModel is an important design decision. Both approaches have their pros and cons, and the decision should be made based on various consi...
40,239
[ { "from": "human", "value": "When implementing the ViewModel in a Model-View-ViewModel architecture WPF application there seem to be two major choices how to make it databindable. I have seen implementations that use DependencyProperty for properties the View is going to bind against and I have seen the Vie...
I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code: <img src="image.py?text=xxxxxxxxxxxxxx"> The problem is that I expect in the future the "text" field will get very long and the URL will become too large. From Googling arou...
Hi Ben, You're correct that the GET method has limitations when it comes to the length of URLs. Different browsers and
41,874
[ { "from": "human", "value": "I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:\n<img src=\"image.py?text=xxxxxxxxxxxxxx\">\n\nThe problem is that I expect in the future the \"text\" field will get very long and t...
I'm getting the strangest results. I have a class with a composite key. If i do the following query: from LOVEJB l order by l.canonicalId desc my results are not ordered by the 'canonicalId' column I asked for. Instead, the canonical id result is like: 823 823 822 823 ,,, Can someone give me some pointers on how ...
When dealing with a composite key and unexpected ordering results in your query, there are several potential issues you might want to
41,749
[ { "from": "human", "value": "I'm getting the strangest results. I have a class with a composite key.\nIf i do the following query:\n\nfrom LOVEJB l order by l.canonicalId\n desc\n\nmy results are not ordered by the 'canonicalId' column I asked for. Instead, the canonical id result is like:\n\n823 823 822 8...
Distributing ASP.NET user controls across different projects can be really useful when you want to create a library of controls that can be used by different projects. Unfortunately, to my knowledge, ASP.NET (2.0 at least) doesn't support this very cleanly. The only technique I know of is to add the control to another ...
Distributing ASP.NET user controls across different projects can be challenging, especially in older versions like ASP.NET 2.0. While the method you described does work, it can indeed feel hackish and cumbersome. Fortunately, there are a few better approaches to consider, especially when working with newer versions of ...
38,570
[ { "from": "human", "value": "Distributing ASP.NET user controls across different projects can be really useful when you want to create a library of controls that can be used by different projects.\nUnfortunately, to my knowledge, ASP.NET (2.0 at least) doesn't support this very cleanly.\nThe only technique ...
I have a MySQL table LOGIN_LOG with fields ID, PLAYER, TIMESTAMP and ACTION. ACTION can be either 'login' or 'logout'. Only around 20% of the logins have an accompanying logout row. For those that do, I want to calculate the average duration. I'm thinking of something like select avg(LL2.TIMESTAMP - LL1.TIMESTAMP) from...
Your current SQL query is conceptually on the right track, but it may not be the most efficient way to calculate the average duration of the login sessions that have corresponding logout records. The main concern is the join structure and filtering mechanism. Let's optimize it by simplifying the logic. Instead of usi...
43,261
[ { "from": "human", "value": "I have a MySQL table LOGIN_LOG with fields ID, PLAYER, TIMESTAMP and ACTION. ACTION can be either 'login' or 'logout'. Only around 20% of the logins have an accompanying logout row. For those that do, I want to calculate the average duration.\nI'm thinking of something like\nsel...
I use something like this: screen.addstr(text, color_pair(1) | A_BOLD), but it doesn't seem to work.. However, A_REVERSE and all others attribute does work! In fact, I'm trying to print something in white, but the COLOR_WHITE prints it gray.. and after a while of searching, it seems that printing it gray + BOLD makes...
It sounds like you are working with the curses library in Python to manipulate text attributes in a terminal. If you're experiencing issues with the color and bold attributes, it could be related to several factors, including terminal settings or how colors are configured in your curses setup. Here are some suggestion...
42,243
[ { "from": "human", "value": "I use something like this: \nscreen.addstr(text, color_pair(1) | A_BOLD), but it doesn't seem to work..\nHowever, A_REVERSE and all others attribute does work! \nIn fact, I'm trying to print something in white, but the COLOR_WHITE prints it gray.. and after a while of searching,...
Deletion operations seems to be the slowest in a YUI datatable. I have a datatable with > 300 rows. I need to delete selected rows. I tried removing the selected records from the recordset and then calling table.render() .. While this is okay, can it be made better?
Deleting rows from a YUI DataTable can indeed become a bottleneck, especially with larger datasets. Here are some strategies to improve the performance of deletion operations in a YUI DataTable: ### 1. Batch Deletion Instead of deleting rows one at a time, try to batch the deletions together. This reduces the number o...
41,677
[ { "from": "human", "value": "Deletion operations seems to be the slowest in a YUI datatable. I have a datatable with > 300 rows. I need to delete selected rows. I tried removing the selected records from the recordset and then calling table.render() .. While this is okay, can it be made better?\n" }, { ...
I have a working TYPO3 extension. It is attached this wiki page. How can I change the code of this extension so it is of the USER_INT type? I.e. I don't want TYPO3 to cache the output of this plugin, and want TYPO3 to invoke the extension ever time a page that uses the extension, i.e. disable the caching for this exten...
To convert a TYPO3 extension from a standard USER type to a USER_INT type, you'll need to modify your extension's configuration in the TypoScript setup. By default, TYPO3 caches the output of USER type plugins, which can lead to issues if you want dynamic content that reflects user sessions or real-time data. Here’s h...
41,893
[ { "from": "human", "value": "I have a working TYPO3 extension. It is attached this wiki page. How can I change the code of this extension so it is of the USER_INT type? I.e. I don't want TYPO3 to cache the output of this plugin, and want TYPO3 to invoke the extension ever time a page that uses the extension...
In my quest to learn javascript (which seems to be my latest source of questions for SO these days) i've found this API for drawing http://www.c-point.com/javascript_vector_draw.htm Meanwhile I've been making some experiments with graphics, which tend to be heavy on the amount of stuff to draw. This guy is drawing with...
Using `<div>` elements to draw pixel-by-pixel is indeed a method that can work, but it has several limitations, particularly in terms of performance and scalability, especially for more elaborate graphics. Here are a few considerations: ### Limitations of Using `<div>`s for Drawing: 1. **Performance**: Creating a lar...
42,788
[ { "from": "human", "value": "In my quest to learn javascript (which seems to be my latest source of questions for SO these days) i've found this API for drawing http://www.c-point.com/javascript_vector_draw.htm\nMeanwhile I've been making some experiments with graphics, which tend to be heavy on the amount ...
I have a SQL Report that insists on printing an extra blank page at the end, even though all the report items should fit on one page. I tried shortening the elements on the page that is spilling over, but no matter how much I compress them, or how much blank space is left on the first page, SRS still thinks it needs t...
In SQL Server Reporting Services (SSRS), encountering extra blank pages can be frustrating, and there are several strategies you can employ to mitigate this issue in both current and future reports. While there isn’t a single flag to enforce "never print more than 1 page," you can follow these best practices to minimiz...
41,123
[ { "from": "human", "value": "I have a SQL Report that insists on printing an extra blank page at the end, even though all the report items should fit on one page. I tried shortening the elements on the page that is spilling over, but no matter how much I compress them, or how much blank space is left on th...
Component Services -> Computers -> My Computer -> COM+ Applications Open a COM+ Application object. Open Components. Right-click on a class and select Properties. Under "Advanced" there is a check box for "Allow IIS intrinsic properties". How do I check this check box programmatically? I can create and delete COM+ Appl...
To programmatically check the "Allow IIS intrinsic properties" checkbox for a COM+ application, you typically would need to work with the COM+ Administration interfaces provided by Microsoft. The check box itself is associated with properties of the COM+ application and can be accessed through the `ComAdmin` API. Here...
42,384
[ { "from": "human", "value": "Component Services -> Computers -> My Computer -> COM+ Applications\nOpen a COM+ Application object.\nOpen Components.\nRight-click on a class and select Properties.\nUnder \"Advanced\" there is a check box for \"Allow IIS intrinsic properties\".\nHow do I check this check box p...
In general at a fairly high level, and without building an entire CMS, what do I need to know about storing web page content (e.g. say several hundred articles and text up to approx. 2500 words in length) and photos in sql server in a templated web page design? Do I store the actual content in the db or store in the fi...
When it comes to storing web page content like articles and photos in a SQL Server database for a templated web design, you have a couple of options regarding how to manage and store the content. Here's a high-level overview of the considerations and some example ASP.NET code to get you started: ### Storage Options 1...
40,784
[ { "from": "human", "value": "In general at a fairly high level, and without building an entire CMS, what do I need to know about storing web page content (e.g. say several hundred articles and text up to approx. 2500 words in length) and photos in sql server in a templated web page design?\nDo I store the a...
I'm having major rendering issues in Safari with the web application I'm working on. Most of the design is done with divs using absolute positioning. This renders fine on Internet Explorer, Firefox, Chrome, Opera, Netscape, and konqueror. In Safari, it's just a jumbled mess. Does Safari lack support for absolute p...
It's great to hear that you were able to identify the issue with your web application! Safari does support absolute positioning for `div` elements, but there can be inconsistencies in how different browsers handle CSS rules, especially when it comes to specificity and the order in which styles are applied. Here are so...
42,622
[ { "from": "human", "value": "I'm having major rendering issues in Safari with the web application I'm working on. Most of the design is done with divs using absolute positioning. This renders fine on Internet Explorer, Firefox, Chrome, Opera, Netscape, and konqueror. In Safari, it's just a jumbled mess. ...
I have a form with a few buttons which execute code when pressed like running validations on the database. Some code can run for a few minutes so is there any way to show the time remaining or a message to display the % of process completed? Or pop out a message when code evaluation starts and the message should disapp...
Certainly! You can implement progress indicators or notifications in your application to give users feedback on long-running processes. Here’s how you can achieve this, depending on the environment and technology stack you’re using. ### 1. Using JavaScript and HTML (for web applications) You can use a combination of ...
40,966
[ { "from": "human", "value": "I have a form with a few buttons which execute code when pressed like running validations on the database.\nSome code can run for a few minutes so is there any way to show the time remaining or a message to display the % of process completed?\nOr pop out a message when code eval...
(Not really a programming question, sorry) I'm working on benchmarking various filesystems (most importantly: ext3) with various filesystem options (for instance: noatime, relatime etc.) for specific situations on a Linux box. For raw filesystem benchmarks, I'm looking into bonnie and bonnie++. What is the most useful...
Benchmarking filesystems can be quite nuanced, and it’s great that you’re looking to use tools like bonnie and bonnie++. Here are some best practices and tips to consider when benchmarking filesystems, as well as recommendations for mounting your ext3 filesystems. ### Using Bonnie and Bonnie++ 1. **Installation
43,609
[ { "from": "human", "value": "(Not really a programming question, sorry)\nI'm working on benchmarking various filesystems (most importantly: ext3) with various filesystem options (for instance: noatime, relatime etc.) for specific situations on a Linux box.\nFor raw filesystem benchmarks, I'm looking into bo...
I need an algorithm to determine if a sentence, paragraph or article is negative or positive in tone... or better yet, how negative or positive. For instance: Jason is the worst SO user I have ever witnessed (-10) Jason is an SO user (0) Jason is the best SO user I have ever seen (+10) Jason is the best at sucking wi...
You're correct that determining sentiment (positive or negative tone) in text is a well-explored area in natural language processing (NLP). This task is generally referred to as sentiment analysis. Here are some approaches and resources that might help you in your search for sentiment analysis algorithms and methodolog...
41,501
[ { "from": "human", "value": "I need an algorithm to determine if a sentence, paragraph or article is negative or positive in tone... or better yet, how negative or positive.\nFor instance:\n\n\nJason is the worst SO user I have ever witnessed (-10)\nJason is an SO user (0)\nJason is the best SO user I have ...
in the multi-threaded app I am porting to Symbian using Open C, I have an object that uses an RFile to read/write data to file. This object is supposed to be accessed from different threads (it is threadsafe), however there is the issue that apparently RFile objects can only be accessed within one thread only. As soon ...
In Symbian C++, `RFile` objects are indeed not thread-safe, and you can't share them directly across multiple threads. The `KERN-EXEC 0` error you are encountering is indicative of a violation of thread safety in your application. Here are some strategies to safely access files from multiple threads in a multi-threade...
40,275
[ { "from": "human", "value": "in the multi-threaded app I am porting to Symbian using Open C, I have an object that uses an RFile to read/write data to file. This object is supposed to be accessed from different threads (it is threadsafe), however there is the issue that apparently RFile objects can only be ...
I'm using GDOME.pm and in my script I have this line: my $doc = XML::GDOME->createDocument("","",""); I can't for the life of me figure out why it's coming out with this error: NAMESPACE_ERR at /usr/lib/perl5/site_perl/5.6.1/i586-linux/XML/GDOME.pm line 103. which basically points to: sub createDocument { my $class...
The `NAMESPACE_ERR` that you're encountering while using `XML::GDOME` typically indicates that there's an issue with the namespaces being used in your document. The `createDocument` method usually requires a proper namespace URI if you're specifying one. If you pass empty strings to it like you've done in your code: `...
42,803
[ { "from": "human", "value": "I'm using GDOME.pm and in my script I have this line:\nmy $doc = XML::GDOME->createDocument(\"\",\"\",\"\");\n\nI can't for the life of me figure out why it's coming out with this error:\nNAMESPACE_ERR at /usr/lib/perl5/site_perl/5.6.1/i586-linux/XML/GDOME.pm line 103.\n\nwhich ...
What's the difference between these two? Which is better/faster/reliable?
To provide you with a meaningful comparison, I need to know what two items or concepts you're referring to. Could you
41,883
[ { "from": "human", "value": "What's the difference between these two?\nWhich is better/faster/reliable?\n" }, { "from": "gpt", "value": "To provide you with a meaningful comparison, I need to know what two items or concepts you're referring to. Could you" } ]
If you have a ListView with both horizontal and vertical scroll bars. How do you tell which one a scroll event is coming from? ScrollBar.Scroll="xxx" doesn't seem to differentiate.
To differentiate between horizontal and vertical scroll events in a `ListView`, you typically have to handle the scroll events directly from the scroll bar controls if your UI framework allows it. Unfortunately, the default scroll event may not provide the specific information about which scroll bar is being used. How...
39,005
[ { "from": "human", "value": "If you have a ListView with both horizontal and vertical scroll bars. How do you tell which one a scroll event is coming from?\nScrollBar.Scroll=\"xxx\" doesn't seem to differentiate.\n" }, { "from": "gpt", "value": "To differentiate between horizontal and vertical s...
We're experimenting with following an agile approach to software development where I work. It's working well so far, however, towards the end of the iteration, we had a problem with a build and it cost a day's worth of time fixing: time that should have been dedicated to testing. As a result, our QA doesn't have enoug...
Dealing with unforeseen problems during an agile iteration is a common challenge, and there are several strategies that can help you mitigate their impact while still adhering to agile principles: 1. **Prioritize Work Effectively**: During sprint planning, ensure that the team focuses on delivering the highest priorit...
38,378
[ { "from": "human", "value": "We're experimenting with following an agile approach to software development where I work. It's working well so far, however, towards the end of the iteration, we had a problem with a build and it cost a day's worth of time fixing: time that should have been dedicated to testin...
The Exception class in Delphi 2009 received a number of new features. A number of them are related to getting a stacktrace: property StackTrace: string read GetStackTrace; property StackInfo: Pointer read FStackInfo; class var GetExceptionStackInfoProc: function (P: PExceptionRecord): Pointer; class var GetStackInfoS...
Yes, the `Exception` class enhancements in Delphi 2009 provide a more integrated approach to obtaining stack traces. These new features make it easier to gather detailed debugging information when an exception is raised. Here's a brief overview of how you can utilize these properties and methods to obtain a stack trace...
40,397
[ { "from": "human", "value": "The Exception class in Delphi 2009 received a number of new features. A number of them are related to getting a stacktrace:\n\nproperty StackTrace: string read GetStackTrace;\nproperty StackInfo: Pointer read FStackInfo;\nclass var GetExceptionStackInfoProc: function (P: PExcep...
I have been able to zip the contents of my folder. But I would like the zipped file to remain in the folder that was just compressed. For example, I've zipped a folder called test in my C: drive. But I would like my "test.zip" file to be contained in C:\test. How can I do this? Thanks in advance. clarification of quest...
To create a ZIP file from a folder and save that ZIP file inside the same folder, you can modify your `zip_folder` function slightly. You will need to construct the path for the ZIP file based on the base directory (`basedir`) you provide. Here’s an updated version of your code: ```python import os import zipfile def...
40,075
[ { "from": "human", "value": "I have been able to zip the contents of my folder. But I would like the zipped file to remain in the folder that was just compressed. For example, I've zipped a folder called test in my C: drive. But I would like my \"test.zip\" file to be contained in C:\\test. How can I do thi...
I'm trying to complete a practice question from a book on generics but the question doesn't make sense to me. Here it goes. Create two classes with identical functionality. Use generics for the first class, and cast the second class to Object types. Create a for loop that uses class and the Object based class to determ...
You're on the right track with your implementation of the classes, but there are some clarifications and improvements needed, especially regarding the "casting to Object types" part. In your second class (`Human`), you're retrieving the value as an `int` but then casting it to an `object`. This doesn't fully demonstrat...
43,451
[ { "from": "human", "value": "I'm trying to complete a practice question from a book on generics but the question doesn't make sense to me. Here it goes.\nCreate two classes with identical functionality. Use generics for the first class, and cast the second class to Object types. Create a for loop that uses ...
I need to read data added to the end of an executable from within that executable . On win32 I have a problem that I cannot open the .exe for reading. I have tried CreateFile and std::ifstream. Is there a way of specifying non-exclusive read access to a file that wasn't initially opened with sharing. EDIT- Great thing ...
In Windows, when you open an executable file, by default, it does not allow other processes to access it for reading if it's already opened without sharing. This is why you are experiencing issues when trying to read from the executable while it is running. However, you can work around this limitation by using the `Cr...
41,862
[ { "from": "human", "value": "I need to read data added to the end of an executable from within that executable .\nOn win32 I have a problem that I cannot open the .exe for reading. I have tried CreateFile and std::ifstream.\nIs there a way of specifying non-exclusive read access to a file that wasn't initia...
In Windows, when you press Alt, and release it again, the menu bar gets activated. However, when you press Alt, then click, then release, the menu bar does not get activated because presumably you wanted to Alt+click, not activate the menu bar. I want to support Alt+mouse wheel changes (which would map to horizontal sc...
In Windows, the behavior you described regarding the activation of the menu bar when the Alt key is released is part of the system's focus and keyboard handling. When you press the Alt key, Windows waits to see if any subsequent key or mouse actions indicate a desire to use the menu bar. If you press Alt and then relea...
42,127
[ { "from": "human", "value": "In Windows, when you press Alt, and release it again, the menu bar gets activated. However, when you press Alt, then click, then release, the menu bar does not get activated because presumably you wanted to Alt+click, not activate the menu bar.\nI want to support Alt+mouse wheel...
I have this code #include <iostream> using namespace std; int main(int argc,char **argv) { unsigned long long num1 = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...
The issue you're encountering stems from the fact that the constants you are trying to assign to `unsigned long long` variables are too large to fit into that type. In C++, the `unsigned long long` type can hold values up to 2^64 - 1, or 18,446,744,073,709,551,615. The numbers you are trying to assign are well beyond t...
28,502
[ { "from": "human", "value": "I have this code\n#include <iostream>\n\nusing namespace std;\n\nint main(int argc,char **argv) {\n\n unsigned long long num1 = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...
I'm trying to insert some import lines into a python source file, but i would ideally like to place them right after the initial docstring. Let's say I load the file into the lines variable like this: lines = open('filename.py').readlines() How to find the line number, where the docstring ends?
To find the line number where the initial docstring ends in a Python source file, you can iterate through the `lines` and look for the closing triple quotes of the docstring. In Python, a docstring is typically defined using triple double quotes (`"""`) or triple single quotes (`'''`). Here’s how you can implement thi...
12,813
[ { "from": "human", "value": "I'm trying to insert some import lines into a python source file, but i would ideally like to place them right after the initial docstring. Let's say I load the file into the lines variable like this:\nlines = open('filename.py').readlines()\n\nHow to find the line number, where...
currently i obtain the below result from the following C# line of code when in es-MX Culture Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-mx"); <span><%=DateTime.Now.ToLongDateString()%></span> miércoles, 22 de octubre de 2008 i would lik...
To achieve the desired output of "Miércoles, 22 de Octubre de 2008" with the capitalization as shown, you do not necessarily need to build your own culture. Instead, you can manually adjust the output of `ToLongDateString()` to capitalize the first letter of the weekday and the month. One straightforward way to accom...
22,441
[ { "from": "human", "value": "currently i obtain the below result from the following C# line of code when in es-MX Culture\n Thread.CurrentThread.CurrentCulture =\n Thread.CurrentThread.CurrentUICulture = new\n CultureInfo(\"es-mx\");\n\n <span><%=DateTime.Now.ToLongDateString()%></spa...
With the XML below, I would like to know how to get the value of text in the case_id node as an attribute for the hidden input tag in the xsl sheet below. Is this possible? <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="data.xsl"?> <NewDataSet> <Cases> <Case> <case_id>30</case_id> ... ......
Yes, it is possible to extract the value of the `<case_id>` node from your XML and use it as the value for the hidden input tag in the XSLT. You can do this by navigating through the XML structure and using the appropriate XPath expression to select the `case_id` value. Here's how you can modify your XSLT to achieve ...
42,619
[ { "from": "human", "value": "With the XML below, I would like to know how to get the value of text in the case_id node as an attribute for the hidden input tag in the xsl sheet below.\nIs this possible?\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"data.xsl\"?>\n<New...
Say you have several webparts, one as a controller and several which take information from the controller and act on it. This is fairly easy to model using the Consumer/Producer interface introduced in ASP 2.0. How would you be able to add interactions the other way around whilst still maintaining the above? A simple...
Yes, your question makes perfect sense and touches on a common challenge when working with web parts in SharePoint, especially in WSS 3.0 (Windows SharePoint Services). You're essentially looking to create a more interactive and dynamic experience where web parts can communicate in multiple directions—specifically, whe...
13,465
[ { "from": "human", "value": "Say you have several webparts, one as a controller and several which take information from the controller and act on it. This is fairly easy to model using the Consumer/Producer interface introduced in ASP 2.0. \nHow would you be able to add interactions the other way around whi...
I want to validate the value a user enters in a text box, so that it only enters float numbers. I'm not interested in range. How can I do this, considering also culture localization information (e.g. "." or "," as separators)?
To validate that the user input in a text box is a float number while considering culture-specific localization (such as using "." or "," as decimal separators), you can follow these steps: ### Approach 1. **Use Regular Expressions**: You can create a regular expression that matches float numbers. However, regex alon...
34,141
[ { "from": "human", "value": "I want to validate the value a user enters in a text box, so that it only enters float numbers. I'm not interested in range. How can I do this, considering also culture localization information (e.g. \".\" or \",\" as separators)?\n" }, { "from": "gpt", "value": "To...
As eclipse users know, eclipse captures the output of std out and err by default and dumps it into the console that is integrated with the IDE. I would like eclipse to just use a standard windows cmd instance to display std:out and std:err by default, the way most other IDE's do. Does anybody know how to set this up?
Eclipse does not have built-in functionality to redirect the standard output (stdout) and standard error (stderr) to an external command prompt (cmd) window by default. However, there are some workarounds you can implement to achieve a similar effect. Below are a couple of methods: ### Method 1: Run the Java Applicati...
35,941
[ { "from": "human", "value": "As eclipse users know, eclipse captures the output of std out and err by default and dumps it into the console that is integrated with the IDE.\nI would like eclipse to just use a standard windows cmd instance to display std:out and std:err by default, the way most other IDE's d...
How to get function's name from function's pointer in C? Edit: The real case is: I'm writing a linux kernel module and I'm calling kernel functions. Some of these functions are pointers and I want to inspect the code of that function in the kernel source. But I don't know which function it is pointing to. I thought it ...
In C, particularly in the context of the Linux kernel, it is not possible to directly obtain the name of a function from a function pointer. Function pointers in C are simply addresses in memory, and the language does not retain any metadata about the function (such as its name) at runtime. ### Understanding Function ...
44,186
[ { "from": "human", "value": "How to get function's name from function's pointer in C?\nEdit: The real case is: I'm writing a linux kernel module and I'm calling kernel functions. Some of these functions are pointers and I want to inspect the code of that function in the kernel source. But I don't know which...
Is it valid to have a 'choice' of 'group' elements when defining an XML Schema (XSD) i.e. is the following valid <xs:complexType name="HeaderType"> <xs:sequence> <xs:element name="reservation-number" type="ReservationNumberType" minOccurs="1" maxOccurs="1" nillable="false" /> <xs:choice minOccurs="1" maxOccur...
Your approach to defining an XML Schema (XSD) using `xs:choice` with `xs:group` is conceptually valid, but there are some nuances to consider. The primary issue is the placement and construction of the choice element. The way you've structured your `xs:choice` element is correct; however, the XML Schema specification ...
13,296
[ { "from": "human", "value": "Is it valid to have a 'choice' of 'group' elements when defining an XML Schema (XSD)\ni.e. is the following valid\n<xs:complexType name=\"HeaderType\">\n <xs:sequence>\n <xs:element name=\"reservation-number\" type=\"ReservationNumberType\" minOccurs=\"1\" maxOccurs=\"1\" ni...
What is the best way to store string data across postback. I need to store an ID and name for multiple entities. I was thinking of using a datatable in viewstate, but would that make viewstate grow too large? I can't use a database yet because I'll be inserting a record that those other records need to be related to...
Storing string data across postbacks in an ASP.NET web application can be done using a few different methods, and it's important to consider both performance and scalability when making your choice. Here are a few options: ### 1. ViewState Using ViewState to store data like IDs and names is a common approach in ASP.NE...
8,637
[ { "from": "human", "value": "What is the best way to store string data across postback. I need to store an ID and name for multiple entities. I was thinking of using a datatable in viewstate, but would that make viewstate grow too large? I can't use a database yet because I'll be inserting a record that ...
Modern browsers have multi-tab interface, but JavaScript function window.showModalDialog() creates a modal dialog that blocks all of the tabs. I'd like to know if there is a way to create a modal dialog that blocks only the tab it's been created in?
The `window.showModalDialog()` method, which creates a modal dialog that blocks interaction with other tabs, has been deprecated and is no longer supported in most modern browsers. The behavior you described, where a modal dialog blocks interaction with all tabs, is not something that can be achieved using standard web...
48,791
[ { "from": "human", "value": "Modern browsers have multi-tab interface, but JavaScript function window.showModalDialog() creates a modal dialog that blocks all of the tabs. \nI'd like to know if there is a way to create a modal dialog that blocks only the tab it's been created in?\n" }, { "from": "g...
I am rendering a certain scene to an off-screen frame buffer (FBO) and then I'm reading the rendered image using glReadPixels() for processing on the CPU. The processing involves some very simple scanning routines and extraction of data. After profiling I realized that most of what my application does is spend time i...
To move your processing from the CPU to the GPU while accessing data from an off-screen framebuffer (FBO) or texture, you have several options, but the most common approaches are using GLSL (OpenGL Shading Language) or compute shaders. Each has its own strengths, so I'll detail the most suitable options for your scenar...
46,859
[ { "from": "human", "value": "I am rendering a certain scene to an off-screen frame buffer (FBO) and then I'm reading the rendered image using glReadPixels() for processing on the CPU. The processing involves some very simple scanning routines and extraction of data. \nAfter profiling I realized that most o...
Current, I've got a stored procedure that has a main goal of doing a full text search through a database table of films and tv shows. In order to get it to do partial-keyword searching, I added some code in SQL to split up the search query by spaces, and output a statement like the following: "batman*" ~ "be*" The ori...
It looks like you're attempting to implement a full-text search with a ranking system that reflects user expectations for relevance based on the search terms. The issue you're facing with the ranking of the results is likely related to how SQL Server's full-text search ranks results based on the entire content of the i...
38,706
[ { "from": "human", "value": "Current, I've got a stored procedure that has a main goal of doing a full text search through a database table of films and tv shows. In order to get it to do partial-keyword searching, I added some code in SQL to split up the search query by spaces, and output a statement like...
I've read a couple of things about MVCs but I still don't understand when they should be used and when they shouldn't be used. I am looking for clear examples that say things like "if you're developing this then you should use MVC, like this" and "if you're developing this, you shouldn't use MVC." Most of the examples ...
Understanding when to use the Model-View-Controller (MVC) design pattern can be nuanced, but I’ll aim to clarify this with examples while also pointing out some resources that you might find helpful. ### When to Use MVC 1. **Web Applications with Complex UI** - **Example:** If you're building a web application li...
36,226
[ { "from": "human", "value": "I've read a couple of things about MVCs but I still don't understand when they should be used and when they shouldn't be used. I am looking for clear examples that say things like \"if you're developing this then you should use MVC, like this\" and \"if you're developing this, y...
Are there some help resources, or can anyone give me a brief Idea how I would configure the .net 2 runtime security policies for the following scenario: I have a windows forms control hosted in IE. The control tries to read from a serial port and write to the event log. Both of these operations fail due to security r...
In .NET Framework 2.0, when running Windows Forms controls hosted in Internet Explorer, you have to configure the security policies correctly in order to allow the control to perform operations such as reading from a serial port and writing to the event log. The security model of .NET restricts certain operations for a...
49,549
[ { "from": "human", "value": "Are there some help resources, or can anyone give me a brief Idea how I would configure the .net 2 runtime security policies for the following scenario:\nI have a windows forms control hosted in IE. The control tries to read from a serial port and write to the event log. Both ...
Windows Programming: How to put a file that is frequently accessed in the OS cache?
To improve the performance of your Windows application that frequently accesses a file, you can leverage the operating system's caching mechanisms. Here are some methods to help keep a file in the OS cache: ### 1. **Read the File into Memory** One straightforward approach is to read the file into your application's me...
36,628
[ { "from": "human", "value": "Windows Programming: How to put a file that is frequently accessed in the OS cache?\n" }, { "from": "gpt", "value": "To improve the performance of your Windows application that frequently accesses a file, you can leverage the operating system's caching mechanisms. He...