instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Is it possible for subsonic to access dbo.sp_help_job?
Yes, it is possible for a user or application using the Subsonic ORM (Object-Relational Mapping) to access SQL Server stored procedures like `dbo.sp_help_job`, but there are some important considerations: 1. **Database Permissions**: The user must have the appropriate permissions to execute the stored procedure. In SQ...
20,621
[ { "from": "human", "value": "Is it possible for subsonic to access dbo.sp_help_job?\n" }, { "from": "gpt", "value": "Yes, it is possible for a user or application using the Subsonic ORM (Object-Relational Mapping) to access SQL Server stored procedures like `dbo.sp_help_job`, but there are some ...
I'm looking to execute a series of queries as part of a migration project. The scripts to be generated are produced from a tool which analyses the legacy database then produces a script to map each of the old entities to an appropriate new record. THe scripts run well for small entities but some have records in the hun...
Handling large SQL scripts effectively during a migration project is crucial to ensure that the process is efficient and manageable. Here are some strategies you can employ to run large SQL scripts, including the use of SQLCMD and other methods: ### 1. Use SQLCMD `SQLCMD` is a command-line utility that allows you to ...
16,399
[ { "from": "human", "value": "I'm looking to execute a series of queries as part of a migration project. The scripts to be generated are produced from a tool which analyses the legacy database then produces a script to map each of the old entities to an appropriate new record. THe scripts run well for small ...
Are there any tools available to log the page load time for a php site? Mainly looking for something that I can see trends of load times over time, I was considering dumping them into a file using error_log(), but I don't know what I could use to parse it and display graphs
Yes, there are several tools and libraries available that can help you log and visualize the page load time for a PHP site. Here are some options you might consider: ### 1. Custom Logging with `error_log()` If you want to use `error_log()` to log page load times, you can do so by appending the load time to a file: ``...
17,280
[ { "from": "human", "value": "Are there any tools available to log the page load time for a php site?\nMainly looking for something that I can see trends of load times over time, I was considering dumping them into a file using error_log(), but I don't know what I could use to parse it and display graphs\n" ...
I would like invoke a function call in a one shot manner. What's the best way to do this in Boost / C++? I would like to pass it two parameters and do not need a result.
In Boost C++, you can invoke a function with parameters in a "one-shot" manner using `boost::bind` or using lambda functions with `std::function`. This allows you to create a callable object that can be executed without needing to store it for reuse. Here’s how you can do this with both approaches: ### Using `boost::...
20,850
[ { "from": "human", "value": "I would like invoke a function call in a one shot manner. What's the best way to do this in Boost / C++?\nI would like to pass it two parameters and do not need a result.\n" }, { "from": "gpt", "value": "In Boost C++, you can invoke a function with parameters in a \"...
I've found a similar question on stack overflow, but it didn't really answer the question I have. I need to make sure that my asp.net application is formatting the date dd/mm/yyyy the same as my SQL Server 2005. How do I verify the date culture (if that's what it's called) of the server matches how I've programmed my a...
To ensure that your ASP.NET application formats dates in `dd/mm/yyyy` format and matches with your SQL Server 2005 settings, you need to consider a few aspects related to culture settings in both your application and your database. Here’s how to verify and manage the date formatting: ### 1. ASP.NET Application Culture...
16,387
[ { "from": "human", "value": "I've found a similar question on stack overflow, but it didn't really answer the question I have. I need to make sure that my asp.net application is formatting the date dd/mm/yyyy the same as my SQL Server 2005.\nHow do I verify the date culture (if that's what it's called) of t...
Are there are good uses of Partial Classes outside the webforms/winforms generated code scenarios? Or is this feature basically to support that?
Partial classes in C# are primarily known for their use in scenarios involving generated code, such as web forms or Windows Forms, but they have several other applications that can enhance the organization, maintainability, and collaboration of codebases. Here are some good uses of partial classes outside of the typica...
18,856
[ { "from": "human", "value": "Are there are good uses of Partial Classes outside the webforms/winforms generated code scenarios? Or is this feature basically to support that?\n" }, { "from": "gpt", "value": "Partial classes in C# are primarily known for their use in scenarios involving generated ...
The following simple "calculator expression" grammar (BNF) can be easily parsed with the a trivial recursive-descent parser, which is predictive LL(1): <expr> := <term> + <term> | <term> - <term> | <term> <term> := <factor> * <factor> <factor> / <factor> ...
The addition of the `<command>` rule introduces ambiguity that complicates the use of a simple LL(1) predictive parser. The reason is that for the parser to decide whether it should apply the `<command>` production `<id> = <expr>` or the `<expr>` production based solely on the next token (the first token of the input),...
18,572
[ { "from": "human", "value": "The following simple \"calculator expression\" grammar (BNF) can be easily parsed with the a trivial recursive-descent parser, which is predictive LL(1):\n<expr> := <term> + <term>\n | <term> - <term>\n | <term>\n<term> := <factor> * <factor...
I have a windows application and I want to save the size, position and WindowState between sessions. There is one caveat however. If the state when closing is minimized then I want to restore to the last visible state, i.e. Normal if it was normal before being minimized or maximized if it was maximized. Is there a pr...
In a Windows Forms application, you can easily save and restore the size, position, and state of your form between sessions. You can achieve this using the properties of the form, such as `Location`, `Size`, and `WindowState`. To implement your specific requirement—where you want to restore the last visible state when...
16,177
[ { "from": "human", "value": "I have a windows application and I want to save the size, position and WindowState between sessions. There is one caveat however. If the state when closing is minimized then I want to restore to the last visible state, i.e. Normal if it was normal before being minimized or max...
For as long as I can remember I have avoided using switch statement fall-through. Actually, I can't remember it ever entering my consciousness as a possible way to do things as it was drilled into my head early on that it was nothing more than a bug in the switch statement. However, today I ran across some code that us...
The topic of switch statement fall-through can indeed spark a lot of debate among programmers, particularly because it touches on issues of clarity, maintainability, and potential for bugs. Let’s break down the two scenarios you provided and discuss the merits and drawbacks of each. ### Safe Fall-Through (Example 1) ...
16,910
[ { "from": "human", "value": "For as long as I can remember I have avoided using switch statement fall-through. Actually, I can't remember it ever entering my consciousness as a possible way to do things as it was drilled into my head early on that it was nothing more than a bug in the switch statement. Howe...
Is there a good way to exclude certain pages from using a HTTP module? I have an application that uses a custom HTTP module to validate a session. The HTTPModule is set up like this in web config: <system.web> <!-- ... --> <httpModules> <add name="SessionValidationModule" type="SessionValidationModule, S...
Excluding certain pages from using an HTTP module in an ASP.NET application can be a bit tricky because the `<httpModules>` section in the `web.config` doesn't support the `<location>` tag as you might expect. Here's a common approach to conditionally apply logic in an HTTP module without having to remove it from spec...
13,062
[ { "from": "human", "value": "Is there a good way to exclude certain pages from using a HTTP module?\nI have an application that uses a custom HTTP module to validate a session. The HTTPModule is set up like this in web config:\n<system.web>\n <!-- ... -->\n <httpModules>\n <add name=\"SessionValidation...
I'm writing an implementation of the XXTEA encryption algorithm that works on "streams", ie, can be used like: crypt mykey < myfile > output. One of the requisites is that it doesn't have access to the file at all (it only reads an fixed size block until find an EOF). The algorithm needs that the data bytes is multiple...
When dealing with padding for binary data in encryption schemes like XXTEA, it's important to ensure that the padding method does not interfere with the actual content of the data. Here are a few elegant alternatives to consider for padding that work well with binary streams and avoid issues with embedded NULLs: ### 1...
16,619
[ { "from": "human", "value": "I'm writing an implementation of the XXTEA encryption algorithm that works on \"streams\", ie, can be used like: crypt mykey < myfile > output.\nOne of the requisites is that it doesn't have access to the file at all (it only reads an fixed size block until find an EOF). The alg...
Is there any open source or free .net ui toolkit containing at least one of the following controls: gantt chart (ms project like) calendar (google calendar like or ms outlook 2003, 2007 like) scheduler (outlook 2007 like) Thanks
Yes, there are several open-source or free .NET UI toolkits that include controls like Gantt charts, calendars, or schedulers. Here are a few options you can consider: 1. **Syncfusion Community Edition**: - Syncfusion offers a free community license for small businesses and individual developers. Their UI toolkit i...
19,319
[ { "from": "human", "value": "Is there any open source or free .net ui toolkit containing at least one of the following controls:\n\ngantt chart (ms project like)\ncalendar (google calendar like or ms outlook 2003, 2007 like)\nscheduler (outlook 2007 like)\n\nThanks\n" }, { "from": "gpt", "value"...
Not really getting the point of the map function. Can anyone explain with examples its use? Are there any performance benefits to using this instead of a loop or is it just sugar?
Certainly! The `map` function in programming, particularly in languages like Python, JavaScript, and others, is a powerful tool for transforming data in collections like lists or arrays. Let's break it down with examples and discuss its benefits. ### What is the `map` function? The `map` function takes two primary ar...
14,893
[ { "from": "human", "value": "Not really getting the point of the map function. Can anyone explain with examples its use?\nAre there any performance benefits to using this instead of a loop or is it just sugar?\n" }, { "from": "gpt", "value": "Certainly! The `map` function in programming, particu...
I am looking for some good links with best practices and sample code on creating RESTful web services using .NET. Also, any other input you might have regarding REST would be greatly appreciated.
Creating RESTful web services using .NET can be straightforward, especially with ASP.NET Core, which provides a powerful framework for building APIs. Here are some resources and best practices for developing RESTful services in .NET: ### Resources and Best Practices 1. **Official Documentation:** - [ASP.NET Core W...
12,460
[ { "from": "human", "value": "I am looking for some good links with best practices and sample code on creating RESTful web services using .NET. \nAlso, any other input you might have regarding REST would be greatly appreciated.\n" }, { "from": "gpt", "value": "Creating RESTful web services using...
How to parse the DOM and determine what row is selected in an ASP.NET ListView? I'm able to interact with the DOM via the HtmlElement in Silverlight, but I have not been able to locate a property indicating the row is selected. For reference, this managed method works fine for an ASP.NET ListBox var elm = HtmlPage.Docu...
In ASP.NET, the `ListView` control doesn't have a built-in selection mechanism like the `ListBox` does, because it is typically used for displaying a list of items without the specific selection functionality that a `ListBox` provides. However, you can implement a selection mechanism for the `ListView` using JavaScript...
18,083
[ { "from": "human", "value": "How to parse the DOM and determine what row is selected in an ASP.NET ListView? I'm able to interact with the DOM via the HtmlElement in Silverlight, but I have not been able to locate a property indicating the row is selected.\nFor reference, this managed method works fine for ...
So, I understand that the following doesn't work, but why doesn't it work? interface Adapter<E> {} class Adaptulator<I> { <E, A extends I & Adapter<E>> void add(Class<E> extl, Class<A> intl) { addAdapterFactory(new AdapterFactory<E, A>(extl, intl)); } } The add() method gives me a compile error, "Cann...
The issue you're facing with your `add` method's type parameters is rooted in how Java's type system handles bounds on generics, particularly in relation to type parameters and their relationships with one another. ### The Problem When you define a type parameter `A` with a bound of `A extends I & Adapter<E>`, you're...
19,495
[ { "from": "human", "value": "So, I understand that the following doesn't work, but why doesn't it work?\ninterface Adapter<E> {}\n\nclass Adaptulator<I> {\n <E, A extends I & Adapter<E>> void add(Class<E> extl, Class<A> intl) {\n addAdapterFactory(new AdapterFactory<E, A>(extl, intl));\n }\n}\n...
I'm programming an application for a 32 bit processor with limited memory (512k flash, 32k RAM). The display on this device is 128x160 with 16 bit color, which would normally consume 40k ram if I were to buffer it on my processor. I don't have that much RAM, so I'm looking for techniques, tips, tricks, ideas for gener...
Creating graphics on a low-memory embedded system can certainly be challenging, but there are various techniques and strategies that can help you generate screen data dynamically without overwhelming your limited RAM. Here are some approaches that you might find useful: ### 1. Tile-based Rendering Instead of maintaini...
15,492
[ { "from": "human", "value": "I'm programming an application for a 32 bit processor with limited memory (512k flash, 32k RAM).\nThe display on this device is 128x160 with 16 bit color, which would normally consume 40k ram if I were to buffer it on my processor. I don't have that much RAM, so I'm looking for...
I am studying how two-phase commit works across a distributed transaction. It is my understanding that in the last part of the phase the transaction coordinator asks each node whether it is ready to commit. If everyone agreed, then it tells them to go ahead and commit. What prevents the following failure? All nodes re...
You are correct in your understanding of how the two-phase commit (2PC) protocol generally operates. The scenario you described indeed highlights one of the key concerns in distributed transactions, particularly related to node failures. However, the two-phase commit protocol is designed to handle such situations and p...
15,265
[ { "from": "human", "value": "I am studying how two-phase commit works across a distributed transaction. It is my understanding that in the last part of the phase the transaction coordinator asks each node whether it is ready to commit. If everyone agreed, then it tells them to go ahead and commit.\nWhat pre...
Is Berkley Packet Filter supported on Windows or is there something comparable which I should use?
Berkley Packet Filter (BPF) is primarily associated with Unix-like operating systems, such as Linux and BSD. Windows does not natively support BPF, but there are alternatives you can consider for packet filtering and network monitoring. ### Alternatives on Windows: 1. **WinPcap/Npcap**: - WinPcap was the original ...
20,159
[ { "from": "human", "value": "Is Berkley Packet Filter supported on Windows or is there something comparable which I should use?\n" }, { "from": "gpt", "value": "Berkley Packet Filter (BPF) is primarily associated with Unix-like operating systems, such as Linux and BSD. Windows does not natively ...
What's the difference between using a define statement and an enum statement in C/C++ (and is there any difference when using them with either C or C++)? For example, when should one use enum {BUFFER = 1234}; over #define BUFFER 1234
In C and C++, both `#define` and `enum` can be used to create named constants, but they have different characteristics, implications, and preferred usage contexts. Here's a comparison of the two, highlighting the differences and when one might be preferred over the other. ### `#define` - **Preprocessor Directive**: `...
17,676
[ { "from": "human", "value": "What's the difference between using a define statement and an enum statement in C/C++ (and is there any difference when using them with either C or C++)?\nFor example, when should one use\nenum {BUFFER = 1234}; \n\nover\n#define BUFFER 1234 \n\n" }, { "from": "gpt", ...
I have a large set of 3rd order polynomials in 3D. in matrix form Pn = [1,t,t2,t4]*[An] [Pn] and [An] are 1xN and 4xN matrices respectively each function has a weight Wn. I want to, for some n, m, T and t0 find the first t where t>t0 such that (Wn*Wm) * |Pn-Pm|-2 > T aside from a the O(n2) "try everything" approach...
The problem you're dealing with involves finding the first time \( t \) greater than \( t_0 \) for which a specific condition involving polynomial functions and weights is satisfied. Since you mentioned that the size of your set of polynomials is on the order of 10-1000, and you're looking for an efficient solution, le...
14,600
[ { "from": "human", "value": "I have a large set of 3rd order polynomials in 3D.\nin matrix form\n\nPn = [1,t,t2,t4]*[An]\n[Pn] and [An] are 1xN and 4xN matrices respectively\n\neach function has a weight Wn. I want to, for some n, m, T and t0 find the first t where t>t0 such that\n\n(Wn*Wm) * |Pn-Pm|-2 > T\...
Can someone take a look at this code and tell me if there's any obvious reason it shouldn't be working? When service.getResponse is called within my code the mocking framework only returns null, not the object I specified. [Test] public void Get_All_Milestones() { var mockRepo = new MockRepository()...
Looking at your code, there are a few potential issues that might cause `service.GetResponse(request)` to return null instead of the mocked response you provided. Here are some points to consider: 1. **Mismatch in Request Object**: The most likely reason your mocking framework (assuming it's a framework like Rhino Moc...
18,902
[ { "from": "human", "value": "Can someone take a look at this code and tell me if there's any obvious reason it shouldn't be working? When service.getResponse is called within my code the mocking framework only returns null, not the object I specified.\n [Test]\n public void Get_All_Milestones()\n {...
I have wrapped Log4net in a static wrapper and want to log loggingEvent.LocationInformation.MethodName loggingEvent.LocationInformation.ClassName However all I get is the name of my wrapper. How can I log that info using a forwardingappender and a static wrapper class like Logger.Debug("Logging to Debug"); Logger...
To include the method and class names from where the log messages originate, you need to manage the logging context in your static wrapper class in a way that allows you to pass along that information to the underlying Log4net logging methods. Here’s a way to achieve that using Log4net's `Log4NetAppender` with a custo...
13,235
[ { "from": "human", "value": "I have wrapped Log4net in a static wrapper and want to log \nloggingEvent.LocationInformation.MethodName\nloggingEvent.LocationInformation.ClassName\n\nHowever all I get is the name of my wrapper.\nHow can I log that info using a forwardingappender and a static wrapper class ...
I'm not sure if this is a strange thing to do or not, or if it is some how code smell...but I was wondering if there was a way (some sort of oop pattern would be nice) to "cast" a base type to a form of its derived type. I know this makes little sense as the derived type will have additional functionality that the pare...
What you're trying to do is an example of an invalid cast and is not a safe operation in object-oriented programming. Specifically, the issue arises because you are attempting to cast an instance of `SomeBaseClass` to `SomeDerivedClass`, which is not possible since `baseClass` was never instantiated as a derived type. ...
18,122
[ { "from": "human", "value": "I'm not sure if this is a strange thing to do or not, or if it is some how code smell...but I was wondering if there was a way (some sort of oop pattern would be nice) to \"cast\" a base type to a form of its derived type. I know this makes little sense as the derived type will ...
So I just interviewed two people today, and gave them "tests" to see what their skills were like. Both are entry level applicants, one of which is actually still in college. Neither applicant saw anything wrong with the following code. I do, obviously or I wouldn't have picked those examples. Do you think these quest...
The examples you've provided do contain some issues that can be analyzed for code quality, efficiency, and potential bugs. While it might be a bit harsh to expect entry-level applicants to catch all these issues, it's also reasonable to gauge their understanding of fundamental programming concepts and code practices. H...
16,210
[ { "from": "human", "value": "So I just interviewed two people today, and gave them \"tests\" to see what their skills were like. Both are entry level applicants, one of which is actually still in college. Neither applicant saw anything wrong with the following code.\nI do, obviously or I wouldn't have pick...
I have a Rails app that I need to deploy. Here are the facts: The app was developed on Windows and requires Windows binary gems The app is to be deployed onto an Open Solaris shared server (Joyent) I do not have permissions to install gems on the server For the non-binary gems, I can simply do a rake gems:unpack local...
Deploying a Ruby on Rails application that relies on Windows-specific binary gems onto a different operating system (like Open Solaris) can be challenging since binary gems are compiled for specific platforms. However, there are a few approaches you can take to get your application running in production: ### 1. **Find...
17,625
[ { "from": "human", "value": "I have a Rails app that I need to deploy. Here are the facts:\n\nThe app was developed on Windows and requires Windows binary gems\nThe app is to be deployed onto an Open Solaris shared server (Joyent)\nI do not have permissions to install gems on the server\nFor the non-binary ...
I want to make sure people can't type the name of a PHP script in the URL and run it. What's the best way of doing this? I could set a variable in the file that will be including this file, and then check that variable in the file being included, but is there an easier way?
To prevent direct access to a PHP script via the URL, there are several effective methods you can use, aside from the approach you mentioned (using a variable to check if the script is included in another script). Here are some common and easier methods to achieve this: ### 1. Use the `.htaccess` File If you are usin...
16,490
[ { "from": "human", "value": "I want to make sure people can't type the name of a PHP script in the URL and run it. What's the best way of doing this?\nI could set a variable in the file that will be including this file, and then check that variable in the file being included, but is there an easier way?\n" ...
I distribute software online, and always wonder if there is a proper way to better define version numbers. Let's assume A.B.C.D in the answers. When do you increase each of the components? Do you use any other version number tricks such as D mod 2 == 1 means it is an in house release only? Do you have beta releases wi...
Version numbering is an important aspect of software distribution, as it helps both developers and users understand the state and stability of a software package. The traditional versioning system you're referencing—A.B.C.D—is a common approach, often called **Semantic Versioning** (SemVer), but it can be adapted based...
17,867
[ { "from": "human", "value": "I distribute software online, and always wonder if there is a proper way to better define version numbers.\nLet's assume A.B.C.D in the answers. When do you increase each of the components?\nDo you use any other version number tricks such as D mod 2 == 1 means it is an in house...
Transactional programming is, in this day and age, a staple in modern development. Concurrency and fault-tolerance are critical to an applications longevity and, rightly so, transactional logic has become easy to implement. As applications grow though, it seems that transactional code tends to become more and more burd...
The issues you've raised regarding transactional programming, especially in the context of distributed systems, are indeed common challenges faced by modern applications. The transition from single-node transactions to distributed transactions introduces complexities that can lead to performance issues such as timeouts...
6,407
[ { "from": "human", "value": "Transactional programming is, in this day and age, a staple in modern development. Concurrency and fault-tolerance are critical to an applications longevity and, rightly so, transactional logic has become easy to implement. As applications grow though, it seems that transactiona...
I'm still trying to learn LINQ, though it's going more smoothly now that I've started to use it daily at work. I still don't feel good at it, though. Does anyone have any challenging practice exercises or puzzles I can use as a code-kata to improve my skills? I'll leave this as community wiki, so maybe it can grow to a...
It's great to hear that you're practicing LINQ daily! Here are some challenging exercises and puzzles that can help you improve your LINQ skills. You can tackle them one by one, or share them with your colleagues for a collaborative learning experience. ### LINQ Practice Exercises 1. **Filter and Sort**: Given a list...
18,004
[ { "from": "human", "value": "I'm still trying to learn LINQ, though it's going more smoothly now that I've started to use it daily at work. I still don't feel good at it, though. Does anyone have any challenging practice exercises or puzzles I can use as a code-kata to improve my skills?\nI'll leave this as...
I am looking for a (preferably pure) python library to do AES 256 encryption and decryption. This library should support the CBC cipher mode and use PKCS7 padding according to the answer to an earlier question of mine. The library should at least work on Mac OS X (10.4) and Windows XP. Ideally just by dropping it into ...
For AES-256 encryption and decryption in CBC mode with PKCS7 padding, you can use the `PyCryptodome` library, which is a self-contained Python package. It's a fork of the older `pycrypto` library and offers better support and maintenance. Here's how you can use it: ### Installation You can install the library via pip...
15,784
[ { "from": "human", "value": "I am looking for a (preferably pure) python library to do AES 256 encryption and decryption.\nThis library should support the CBC cipher mode and use PKCS7 padding according to the answer to an earlier question of mine.\nThe library should at least work on Mac OS X (10.4) and Wi...
There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the contempt was simply subjective, I cannot i...
The discussions around `reduce()` in Python, especially its removal from the built-in functions in Python 3 (where it was moved to the `functools` module), can be understood from several perspectives. ### Reasons for Controversy: 1. **Readability**: One of the core philosophies of Python is that "readability counts."...
19,772
[ { "from": "human", "value": "There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the c...
I'd sooner not just permanently have a bunch of files checked out to me, but I'd like a way to prevent some really critical files being changed without my being aware of it. PS Yes I know SourceSafe is terrible.
If you're looking to protect critical files in a SourceSafe environment, even though it's not the most robust version control system, there are still some strategies you can use: 1. **User Permissions**: Set up user permissions to restrict who can check in changes to critical files. You can limit write access to speci...
20,732
[ { "from": "human", "value": "I'd sooner not just permanently have a bunch of files checked out to me, but I'd like a way to prevent some really critical files being changed without my being aware of it.\nPS Yes I know SourceSafe is terrible. \n" }, { "from": "gpt", "value": "If you're looking to...
I am creating a small application that will be deployed on Window. The database will have less than 10 tables. Instead of installing a database on the client box is using XML documents for the database and LINQ going to cost in performance of queries, waiting for the XML file to be loaded and be written? If I use a...
Using XML documents for data storage in a small application can be a viable option, particularly if your data set is relatively small (like 10 tables) and you don't expect it to grow significantly. However, there are trade-offs between using XML files and a traditional database system such as SQL Server or SQLite. Here...
18,690
[ { "from": "human", "value": "I am creating a small application that will be deployed on Window. The database will have less than 10 tables. \nInstead of installing a database on the client box is using XML documents for the database and LINQ going to cost in performance of queries, waiting for the XML fi...
I want to store a large number of sound files in a database, but I don't know if it is a good practice. I would like to know the pros and cons of doing it in this way. I also thought on the possibility to have "links" to those files, but maybe this will carry more problems than solutions. Any experience in this directi...
Storing sound files in a database versus keeping them as files on a file system with references (links) in the database is a common design decision in software architecture. Below are the pros and cons of both approaches: ### Storing Sound Files in the Database #### Pros: 1. **Atomicity**: Storing files in the databa...
15,639
[ { "from": "human", "value": "I want to store a large number of sound files in a database, but I don't know if it is a good practice. I would like to know the pros and cons of doing it in this way.\nI also thought on the possibility to have \"links\" to those files, but maybe this will carry more problems th...
I'm having some minor problems with some animations I'm trying to set up. I have a couple divs stacked on top of each other kind of like this. <div id="div1"> Stuff... </div> <div id="div2"> More Stuff... </div> Each of these divs has a drop shadow applied to it via jQuery plugin (jquery.dropshadow.js). The pro...
To achieve a smooth drop shadow effect while animating the size of your divs, you can consider a few different approaches: ### 1. Redraw Shadow Periodically During Animation If you want to stick with the jQuery plugin you're using, you can call the redraw function at regular intervals during the animation. This can b...
17,525
[ { "from": "human", "value": "I'm having some minor problems with some animations I'm trying to set up. I have a couple divs stacked on top of each other kind of like this.\n<div id=\"div1\">\n Stuff...\n</div>\n<div id=\"div2\">\n More Stuff...\n</div>\n\nEach of these divs has a drop shadow applied to...
I've inherited a VB.net project that generates 2 DLLS: one for the web app, and another for the "business layer". This is for a sub-app of a larger web site. (Using VS2005). The problem is that that something doesn't smell right with the DLL & namespace structure, and I'd like to know if there are any performance impa...
The structure you have described, where both `Foo.dll` (the main web application) and `FooLib.dll` (the business layer) contain classes in the same namespace (`App.Foo`), can lead to a few issues that might not only affect the organization of your code but could also have potential implications for maintainability and ...
17,210
[ { "from": "human", "value": "I've inherited a VB.net project that generates 2 DLLS: one for the web app, and another for the \"business layer\". This is for a sub-app of a larger web site. (Using VS2005).\nThe problem is that that something doesn't smell right with the DLL & namespace structure, and I'd li...
I'm a Drupal newbie. Is it possible to set up everything and deploy Drupal on the server? I mean things like putting in the content, setting up the modules, etc..., then you put it all up to the production server?
Yes, it is entirely possible to set up your Drupal site locally (on your development machine) and then deploy it to a production server. This approach is common and allows you to develop and test your site thoroughly before making it live. Here’s a general step-by-step process on how to do it: ### Step 1: Set Up Your ...
14,935
[ { "from": "human", "value": "I'm a Drupal newbie. Is it possible to set up everything and deploy Drupal on the server? I mean things like putting in the content, setting up the modules, etc..., then you put it all up to the production server?\n" }, { "from": "gpt", "value": "Yes, it is entirely ...
I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a "logs" directory. Since regular users can run this application, that directory needs to be writable by regular users. How do I specify that all users should have permission to ha...
To achieve the goal of creating a directory that allows all users to have write access to it during the installation with Nullsoft Install System (NSIS), you can use the `SetShellVarContext` command to specify that the installation is for all users, and the `CreateDirectory` command to create the logs directory with th...
13,352
[ { "from": "human", "value": "I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a \"logs\" directory. Since regular users can run this application, that directory needs to be writable by regular users. How do I specify ...
How do I prevent my users from accessing directly pages meant for ajax calls only? Passing a key during ajax call seems like a solution, whereas access without the key will not be processed. But it is also easy to fabricate the key, no? Curse of View Source... p/s: Using Apache as webserver. EDIT: To answer why, I have...
Preventing direct access to pages meant for AJAX calls is a common challenge in web development. Here are several strategies you can employ to secure your AJAX endpoints more effectively: ### 1. **Check Request Headers** You can check for specific headers that are typically included in AJAX requests. For example, you...
17,154
[ { "from": "human", "value": "How do I prevent my users from accessing directly pages meant for ajax calls only?\nPassing a key during ajax call seems like a solution, whereas access without the key will not be processed. But it is also easy to fabricate the key, no? Curse of View Source...\np/s: Using Apach...
I've been refactoring my models and controllers in an effort to remove code duplication, and so far it seems to be all peachy creamy. Currently I've got a bit of code that is common to two of my controllers, like so: def process_filters # Filter hash we're going to pass to the model filter_to_use = {} # To proces...
Absolutely! You can make your `process_filters` method more dynamic by leveraging the `controller_name` to reference the appropriate model. You can do this by using Ruby's constant lookup capability or by building the class name from the controller name. Here's how you can refactor your `process_filters` method to make...
17,197
[ { "from": "human", "value": "I've been refactoring my models and controllers in an effort to remove code duplication, and so far it seems to be all peachy creamy. Currently I've got a bit of code that is common to two of my controllers, like so:\ndef process_filters\n# Filter hash we're going to pass to th...
We have an "engine" that loads dlls dynamically (whatever is located in a certain directory) and calls Workflow classes from them by way of reflection. We now have some new Workflows that require access to a database, so I figured that I would put a config file in the dll directory. But for some reason my Workflows jus...
When loading DLLs dynamically and using reflection to access classes or methods within them, the configuration settings may not automatically be read from a separate configuration file located in the same directory as your DLLs. Here are a few strategies to ensure your workflows can access the configuration settings yo...
16,444
[ { "from": "human", "value": "We have an \"engine\" that loads dlls dynamically (whatever is located in a certain directory) and calls Workflow classes from them by way of reflection.\nWe now have some new Workflows that require access to a database, so I figured that I would put a config file in the dll dir...
In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so the vertical border still appears down the page even if there isn't any content to display. Here is my DEMO: body { ...
To make your `#content` div stretch to the bottom of the page, even when there's no content, you can use CSS to achieve a full height layout. One common approach is to use Flexbox. Here's how you can modify your existing CSS to accomplish this: ```css html, body { height: 100%; /* Make sure the html and body eleme...
13,450
[ { "from": "human", "value": "In the markup shown below, I'm trying to get the content div to stretch all the way to the bottom of the page but it's only stretching if there's content to display. The reason I want to do this is so the vertical border still appears down the page even if there isn't any conten...
I'm new to Flex SDK and trying to implement a simple project using Doug Mccune's CoverFlow widget. Most of the documentation out there on how to do this assumes that one is using Adobe's FlexBuilder product, which is a $250 Eclipse plug-in that I'd rather avoid buying. The problem I'm having is simply getting Doug's ...
It sounds like you're having some trouble getting Doug McCune's CoverFlow component to work with the Flex SDK and `mxmlc`. Here are some steps and troubleshooting tips to ensure you can compile your Flex application successfully. ### 1. Ensure the SWC File is Properly Referenced The `-library-path+=` parameter is used...
18,473
[ { "from": "human", "value": "I'm new to Flex SDK and trying to implement a simple project using Doug Mccune's CoverFlow widget. Most of the documentation out there on how to do this assumes that one is using Adobe's FlexBuilder product, which is a $250 Eclipse plug-in that I'd rather avoid buying. The pro...
Is it possible that Microsoft will be able to make F# programs, either at VM execution time, or more likely at compile time, detect that a program was built with a functional language and automatically parallelize it better? Right now I believe there is no such effort to try and execute a program that was built as si...
The idea of automatically parallelizing programs, especially those written in functional languages like F#, is an intriguing one. There are several layers to consider when discussing whether Microsoft or any other organization could effectively implement such a feature, and how it would manifest in terms of performance...
11,730
[ { "from": "human", "value": "Is it possible that Microsoft will be able to make F# programs, either at VM execution time, or more likely at compile time, detect that a program was built with a functional language and automatically parallelize it better? \nRight now I believe there is no such effort to try ...
C#6 Update In C#6 ?. is now a language feature: // C#1-5 propertyValue1 = myObject != null ? myObject.StringProperty : null; // C#6 propertyValue1 = myObject?.StringProperty; The question below still applies to older versions, but if developing a new application using the new ?. operator is far better practice. Orig...
Your question raises several important points about using extension methods for null checks in C#. Let's break down the key considerations regarding your approach, its potential pitfalls, and the trade-offs associated with such a design. ### Using Extension Methods for Null Checks 1. **Readability**: Your proposed `I...
13,368
[ { "from": "human", "value": "C#6 Update\nIn C#6 ?. is now a language feature:\n// C#1-5\npropertyValue1 = myObject != null ? myObject.StringProperty : null; \n\n// C#6\npropertyValue1 = myObject?.StringProperty;\n\nThe question below still applies to older versions, but if developing a new application using...
We have a production web and database server with SQL Server 2000. (However, a few clients they have their own servers with SQL 2005.) So we have local installs of SQL 2005 Express for development on Windows XP SP3 boxes (which don't allow SQL 2000 Enterprise installations). We often need to copy SQL 2000 databases to...
You have a few options for transferring databases from SQL Server 2000 to SQL Server 2005 without relying on the SQL Publishing tool or the Copy Database Wizard, especially given the limitations you're facing with SQL Server 2005 Express. Here are some alternatives you might consider: 1. **Backup and Restore**: This i...
17,618
[ { "from": "human", "value": "We have a production web and database server with SQL Server 2000. (However, a few clients they have their own servers with SQL 2005.) So we have local installs of SQL 2005 Express for development on Windows XP SP3 boxes (which don't allow SQL 2000 Enterprise installations). \nW...
I'm using Express currently. What extra features do I get with the full edition?
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. It is well-known for its simplicity and efficiency. However, it's important to note that "Express" itself does not have a "full edition" as it is an open-source framework. That s...
17,808
[ { "from": "human", "value": "I'm using Express currently. What extra features do I get with the full edition?\n" }, { "from": "gpt", "value": "Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. It is well-kn...
I want to intercept a request in a filter/servlet and add a few parameters to it. However, the request does not expose a 'setParameter' method and the parameter map when manipulated throws an error saying it is locked. Is there an alternative I can try?
In a Servlet or Filter, the HTTP request object (`HttpServletRequest`) is immutable when it comes to the parameters it holds. This means you cannot modify the parameters directly using a `setParameter` method or by manipulating the parameter map directly. However, there are a few ways to achieve the functionality you d...
17,845
[ { "from": "human", "value": "I want to intercept a request in a filter/servlet and add a few parameters to it. However, the request does not expose a 'setParameter' method and the parameter map when manipulated throws an error saying it is locked. Is there an alternative I can try?\n" }, { "from": "...
I'm the leader of a small web development team, and I have a feeling that we will have a couple telecommuters joining the team pretty soon (either new employees, or existing employees that will begin telecommuting). Any idea how to effectively manage and collaborate with developers working remotely? Most of the work w...
Managing a remote web development team can indeed pose unique challenges, particularly in collaborative environments where client work and agile methodologies are central. Here are some practical strategies and tools you can use to enhance remote collaboration and improve communication among your team members: ### 1. ...
15,352
[ { "from": "human", "value": "I'm the leader of a small web development team, and I have a feeling that we will have a couple telecommuters joining the team pretty soon (either new employees, or existing employees that will begin telecommuting). Any idea how to effectively manage and collaborate with develo...
With this code I can show an animated gif while the server script is running: function calculateTotals() { $('#results').load('getResults.php', null, showStatusFinished); showLoadStatus(); } function showLoadStatus() { $('#status').html(''); } function showStatusFinished() { $('#status').html('Finish...
To display a progress status in your client-side code while your server script is running, you can use AJAX to periodically fetch the current status from the server. This approach involves creating a separate endpoint to retrieve the progress and using `setInterval` in your JavaScript to poll this endpoint every second...
18,713
[ { "from": "human", "value": "With this code I can show an animated gif while the server script is running:\nfunction calculateTotals() {\n $('#results').load('getResults.php', null, showStatusFinished);\n showLoadStatus();\n}\n\nfunction showLoadStatus() {\n $('#status').html('');\n}\n\n\nfunction ...
Anyone know a simple way using Java calendar to subtract X days from a date? I have not been able to find any function which allows me to directly subtract X days from a date in Java. Can someone point me to the right direction?
In Java, you can use the `java.util.Calendar` class to manipulate dates, including subtracting days from a specific date. However, a more modern approach would be to use the `java.time` package introduced in Java 8, specifically the `LocalDate` class. Here's how you can do it using both `Calendar` and `LocalDate`. ##...
20,269
[ { "from": "human", "value": "Anyone know a simple way using Java calendar to subtract X days from a date?\nI have not been able to find any function which allows me to directly subtract X days from a date in Java. Can someone point me to the right direction?\n" }, { "from": "gpt", "value": "In J...
I have heard of desktop applications whose code has been open-sourced, but are there any websites whose code has been open-sourced? I don't think I have heard of any. If there are aren't any, are there any reasons why? This will have the advantage of not having to wait for the web development team to include a new feat...
Yes, there are websites whose code has been open-sourced, although they might not be as common as open-source desktop applications. Several notable projects and platforms have open-sourced their codebase, enabling developers to contribute, modify, and even self-host versions of these applications. Here are some example...
20,324
[ { "from": "human", "value": "I have heard of desktop applications whose code has been open-sourced, but are there any websites whose code has been open-sourced? I don't think I have heard of any. If there are aren't any, are there any reasons why?\nThis will have the advantage of not having to wait for the ...
I didn't know I would be getting too many replies so fast. I can provide more details. It is definitely for use within the company. I was looking for some info on whether I should be more careful or anything to watch out for... My boss is asking me to put some tracking info on what users do with their application. It i...
When implementing tracking or monitoring systems within an application, especially if they involve screenshots or other forms of data collection, it is crucial to consider several important factors regarding privacy, ethics, and legal implications. Here are some key points to keep in mind: 1. **Transparency**: Informi...
17,078
[ { "from": "human", "value": "I didn't know I would be getting too many replies so fast. I can provide more details. It is definitely for use within the company. I was looking for some info on whether I should be more careful or anything to watch out for...\nMy boss is asking me to put some tracking info on ...
I recently turned on Windows Firewall logging on my computer and started tracking incoming and outgoing connections. Something curious about the logfiles is that I have noticed numerous UDP packets (in fact, it constitutes basically all of my incoming traffic) that don't have my host as destination or source showing up...
It looks like you're encountering some multicast and broadcast traffic on your network, which can be a normal occurrence, especially in local networks. Let's break down what's happening: 1. **UDP and Broadcast/Multicast:** - UDP (User Datagram Protocol) is a connectionless protocol that does not require a direct co...
18,336
[ { "from": "human", "value": "I recently turned on Windows Firewall logging on my computer and started tracking incoming and outgoing connections. Something curious about the logfiles is that I have noticed numerous UDP packets (in fact, it constitutes basically all of my incoming traffic) that don't have my...
At my new workplace, they represent a lot of dates as "days since epoch" (which I will hereafter call DSE). I'm running into issues in JavaScript converting from DSE to seconds since epoch (UNIX timestamps). Here's my function to do the conversion: function daysToTimestamp(days) { return Math.round(+days * 86400); ...
The discrepancy you're observing arises from the way you're converting the "days since epoch" (DSE) into a UNIX timestamp. The UNIX epoch is defined as midnight (00:00:00 UTC) on January 1, 1970. When you call `daysToTimestamp(13878)`, you're effectively converting 13878 days into seconds. However, it looks like you ...
18,732
[ { "from": "human", "value": "At my new workplace, they represent a lot of dates as \"days since epoch\" (which I will hereafter call DSE). I'm running into issues in JavaScript converting from DSE to seconds since epoch (UNIX timestamps). Here's my function to do the conversion:\nfunction daysToTimestamp(da...
There are a lot of different systems for balancing load and achieving redundancy in production servers (Not just web servers) Round-robin DNS Linux Virtual Server Cisco Local Director F5 BigIP Windows NLB etc? If you use one of these (or another) in production, which one? How well does it work for you? Have you evalu...
As an AI language model, I don't personally use or evaluate systems, but I can provide information about various load balancing and redundancy solutions that are commonly used in production environments. Each of these systems has its strengths and weaknesses, and the best choice depends on specific requirements, existi...
15,675
[ { "from": "human", "value": "There are a lot of different systems for balancing load and achieving redundancy in production servers (Not just web servers)\n\nRound-robin DNS\nLinux Virtual Server\nCisco Local Director\nF5 BigIP\nWindows NLB\netc?\n\nIf you use one of these (or another) in production, which ...
We have industrial automation application developed in .NET 3.5 framework. I have to list out the available serial ports in the computer for our user. As part this, if any of the serial port is already opened, I have to show "In Use" status. I tried google but no luck. Can someone help me please? Regards, Krishgy
To list the available serial ports in a .NET 3.5 application and check if any of them are already in use, you can use the `System.IO.Ports.SerialPort` class. The `SerialPort.GetPortNames()` method will give you a list of available serial port names. However, to determine if a port is in use, you will have to attempt to...
17,334
[ { "from": "human", "value": "We have industrial automation application developed in .NET 3.5 framework.\nI have to list out the available serial ports in the computer for our user. As part this, if any of the serial port is already opened, I have to show \"In Use\" status. I tried google but no luck. \nCan...
I am receiving a message from a commercial program stating that the "LogMessage" stored procedure is not found. There does not appear to be a stored procedure called LogMessage in the associated MS SQLServer 2000 database. What can I do to track down the missing procedure, other than calling the company?
If you're receiving an error message indicating that the "LogMessage" stored procedure is not found in your MS SQL Server 2000 database, there are several steps you can take to investigate and potentially resolve the issue: ### 1. **Check for Typographical Errors** - Verify the exact name of the stored procedure as...
12,860
[ { "from": "human", "value": "I am receiving a message from a commercial program stating that the \"LogMessage\" stored procedure is not found. There does not appear to be a stored procedure called LogMessage in the associated MS SQLServer 2000 database. What can I do to track down the missing procedure, o...
I know I can cycle through my tabs using cmd+{ or cmd+}, but is it possible to select a specific tab (i.e. cmd+3 for the third tab in iTerm) in Leopards' Terminal.app?
In macOS's Terminal app, there isn't a built-in keyboard shortcut to jump directly to a specific tab like you can in iTerm2 (with `cmd+3` for the third tab, for example). However, you can use a workaround to achieve something similar by assigning custom keyboard shortcuts through macOS's System Preferences or using App...
21,353
[ { "from": "human", "value": "I know I can cycle through my tabs using cmd+{ or cmd+}, but is it possible to select a specific tab (i.e. cmd+3 for the third tab in iTerm) in Leopards' Terminal.app? \n" }, { "from": "gpt", "value": "In macOS's Terminal app, there isn't a built-in keyboard shortcut...
I'm looking for for a Jabber library for Delphi, I can see some COM based jabber components. But I'm looking for a real VCL library. Somebody knows one?
For working with Jabber (XMPP) in Delphi, there are a few libraries that you can consider, particularly those that are native VCL components rather than COM-based. Here are some options: 1. **XmppClient**: This is a lightweight XMPP library for Delphi. It's designed to be easy to use and has no dependencies on COM. Yo...
20,902
[ { "from": "human", "value": "I'm looking for for a Jabber library for Delphi, I can see some COM based jabber components. But I'm looking for a real VCL library.\nSomebody knows one?\n" }, { "from": "gpt", "value": "For working with Jabber (XMPP) in Delphi, there are a few libraries that you can...
I have a Excel macro that generates a this error whenever it gets input of a specific format. Does anyone knows in general what an advise flag is OR where can I find information on this type of error? Thanks Runtime error -2147221503 (80040001): Automation error, Invalid advise flags
The error you're encountering, **"Runtime error -2147221503 (80040001): Automation error, Invalid advise flags,"** is an automation error that typically occurs in the context of using COM (Component Object Model) objects in VBA (Visual Basic for Applications), especially when dealing with events or interfaces. ### Pos...
16,118
[ { "from": "human", "value": "I have a Excel macro that generates a this error whenever it gets input of a specific format. Does anyone knows in general what an advise flag is OR where can I find information on this type of error? Thanks\n\nRuntime error -2147221503\n (80040001): Automation error, Invalid\n...
Multiple approaches exist to write your unit tests when using Rhino Mocks: The Standard Syntax Record/Replay Syntax The Fluent Syntax What is the ideal and most frictionless way?
When it comes to writing unit tests with Rhino Mocks, the ideal and most frictionless approach can vary depending on personal preference and the specific context of your testing needs. However, here’s a brief overview of the three approaches you've mentioned, along with some insights into which might be considered the ...
12,144
[ { "from": "human", "value": "Multiple approaches exist to write your unit tests when using Rhino Mocks:\n\nThe Standard Syntax\nRecord/Replay Syntax\nThe Fluent Syntax\n\nWhat is the ideal and most frictionless way?\n" }, { "from": "gpt", "value": "When it comes to writing unit tests with Rhino ...
Coming from a C# background the naming convention for variables and methods are usually either camelCase or PascalCase: // C# example string thisIsMyVariable = "a" public void ThisIsMyMethod() In Python, I have seen the above but I have also seen snake_case being used: # python example this_is_my_variable = 'a' def th...
Yes, there is a widely accepted coding style for Python known as PEP 8, which is the Python Enhancement Proposal that provides guidelines and best practices on how to write Python code. ### Variable and Function Naming Conventions in PEP 8 1. **Variable Names**: Use `snake_case` for variable names. This means that yo...
19,347
[ { "from": "human", "value": "Coming from a C# background the naming convention for variables and methods are usually either camelCase or PascalCase:\n// C# example\nstring thisIsMyVariable = \"a\"\npublic void ThisIsMyMethod()\n\nIn Python, I have seen the above but I have also seen snake_case being used:\n...
Is entity framework just a fancy name for another CRUD code generator? Or is there more to it?
Entity Framework (EF) is more than just a fancy name for a CRUD (Create, Read, Update, Delete) code generator. While it does provide functionalities for generating basic CRUD operations, it offers a comprehensive set of features that make it a powerful Object-Relational Mapping (ORM) tool. ### Key Features of Entity F...
15,452
[ { "from": "human", "value": "Is entity framework just a fancy name for another CRUD code generator?\nOr is there more to it?\n" }, { "from": "gpt", "value": "Entity Framework (EF) is more than just a fancy name for a CRUD (Create, Read, Update, Delete) code generator. While it does provide funct...
I would like to throw an exception when my C++ methods encounter something weird and can't recover. Is it OK to throw a std::string pointer? Here's what I was looking forward to doing: void Foo::Bar() { if(!QueryPerformanceTimer(&m_baz)) { throw new std::string("it's the end of the world!"); } } void F...
Throwing a `std::string` pointer is not a recommended practice in C++. Instead, you should throw exceptions by value, not by pointer. This is because standard C++ exceptions are intended to be thrown and caught by value, which allows for better memory management, exception safety, and code readability. In your case, ...
18,093
[ { "from": "human", "value": "I would like to throw an exception when my C++ methods encounter something weird and can't recover. Is it OK to throw a std::string pointer?\nHere's what I was looking forward to doing:\nvoid Foo::Bar() {\n if(!QueryPerformanceTimer(&m_baz)) {\n throw new std::string(\...
What is the most efficient way to write the old-school: StringBuilder sb = new StringBuilder(); if (strings.Count > 0) { foreach (string s in strings) { sb.Append(s + ", "); } sb.Remove(sb.Length - 2, 2); } return sb.ToString(); ...in LINQ?
You can achieve a more concise and efficient approach using LINQ by leveraging the `string.Join` method. This method takes care of concatenating the strings and adding the specified separator without needing to manually append each string or remove the trailing separator. Here's how you can rewrite your code: ```cshar...
23,120
[ { "from": "human", "value": "What is the most efficient way to write the old-school:\nStringBuilder sb = new StringBuilder();\nif (strings.Count > 0)\n{\n foreach (string s in strings)\n {\n sb.Append(s + \", \");\n }\n sb.Remove(sb.Length - 2, 2);\n}\nreturn sb.ToString();\n\n...in LINQ?...
I need to install some .NET software on several PC's. This software needs to check each time it is restarted to see if a newer version exists on the server. The end users will have basic user rights and therefore cannot copy files to the 'Program Files' directory. If a newer version exists, the application closes, an u...
You're on the right track in thinking about using a service to manage application updates, especially considering the limitations of user rights for your end-users. Here are some insights into your approach and answers to your questions: ### Key Considerations for Your Update Mechanism 1. **Application Independence**...
17,246
[ { "from": "human", "value": "I need to install some .NET software on several PC's.\nThis software needs to check each time it is restarted to see if a newer version exists on the server.\nThe end users will have basic user rights and therefore cannot copy files to the 'Program Files' directory.\nIf a newer ...
I got a program with a fscanf like this: fscanf(stdin, "%d %d,.... I got many fscanf and files that I'd like to test, the files are like this 10485770 15 51200000 -2 10 10 10485760 10485760 10 10485760 10485760 10 10485760 10485760 Well my question is how can I tell to the program or the compiler to take the inputs n...
To redirect input from a file instead of typing it manually in the console (stdin), you can use input redirection in your command line. This is a common practice when dealing with programs that read from standard input (stdin). ### Here's how you can do it: 1. **Save your input in a file**: Ensure your inputs are sa...
19,641
[ { "from": "human", "value": "I got a program with a fscanf like this:\nfscanf(stdin, \"%d %d,....\nI got many fscanf and files that I'd like to test, the files are like this\n10485770 15 51200000\n -2 10 \n10 10485760 10485760\n10 10485760 10485760\n10 10485760 10485760\nWell my question is how can I tell t...
I have a web service API. Some calls return objects containing text fields with information provided by the user. From both a design and a security standpoint, what are the downsides to returning null in those fields when no information has been provided? Is there a clear advantage to always returning an empty string i...
When designing a web service API, how you handle missing or unprovided information can have several implications for both design and security. Let's explore the downsides of returning `null` for text fields versus returning an empty string. ### Downsides of Returning `null`: 1. **Increased Complexity for Clients**: C...
18,194
[ { "from": "human", "value": "I have a web service API. Some calls return objects containing text fields with information provided by the user. From both a design and a security standpoint, what are the downsides to returning null in those fields when no information has been provided? Is there a clear advant...
Is their any profilers that support Silverlight? I have tried ANTS (Version 3.1) without any success? Does version 4 support it? Any other products I can try? Updated since the release of Silverlight 4, it is now possible to do full profiling on SL applications... check out this article on the topic At PDC, I announce...
As of the release of Silverlight 4, profiling Silverlight applications has become much easier due to the introduction of the CoreCLR capability. With this enhancement, developers can utilize Visual Studio 2010 profilers to get insights into both managed and native code within their Silverlight applications. This allows...
13,464
[ { "from": "human", "value": "Is their any profilers that support Silverlight? I have tried ANTS (Version 3.1) without any success? Does version 4 support it? Any other products I can try?\nUpdated\nsince the release of Silverlight 4, it is now possible to do full profiling on SL applications... check out th...
I am studying the content of "Programming Ruby- The Pragmatic Programmer's Guide" but the HTML version does not include the Figures. Are the figures available anywhere online?
As of my last knowledge update in October 2023, the figures from "Programming Ruby: The Pragmatic Programmer's Guide" are not officially hosted online for free access. However, you may find some supplemental materials on the publisher's website or resources related to the book. Your best option might be to check the ...
22,518
[ { "from": "human", "value": "I am studying the content of \"Programming Ruby- The Pragmatic Programmer's Guide\" but the HTML version does not include the Figures.\nAre the figures available anywhere online?\n" }, { "from": "gpt", "value": "As of my last knowledge update in October 2023, the fig...
I have a source base that, depending on defined flags at build time, creates two different apps. I can build both of these apps using a Makefile by specifying two different targets, one that compiles with a flag and one that compiles without, and having an aggregate target that builds both. How do I do the equivalent t...
In Visual C# Express (or Visual Studio in general), you can achieve similar functionality to your Makefile by utilizing project configurations and conditional compilation symbols. Here’s how you can set this up to create two different applications based on defined flags at build time: ### Step 1: Create a New Project ...
18,912
[ { "from": "human", "value": "I have a source base that, depending on defined flags at build time, creates two different apps. I can build both of these apps using a Makefile by specifying two different targets, one that compiles with a flag and one that compiles without, and having an aggregate target that ...
I'm trying to use the Microsoft.Sdc.Tasks.ServiceProcess.Exists to check whether or not a service exists. There is no example of using it in the documentation though. Anyone have one?
Certainly! The `Microsoft.Sdc.Tasks.ServiceProcess.Exists` task is used in MSBuild scripts to check for the existence of a Windows service. Since documentation examples can sometimes be sparse, here's how you might use it in your MSBuild project file. ### Example Usage of `Microsoft.Sdc.Tasks.ServiceProcess.Exists` H...
14,891
[ { "from": "human", "value": "I'm trying to use the Microsoft.Sdc.Tasks.ServiceProcess.Exists to check whether or not a service exists. There is no example of using it in the documentation though. Anyone have one?\n" }, { "from": "gpt", "value": "Certainly! The `Microsoft.Sdc.Tasks.ServiceProce...
How would you design and implement OpenID components? (Was "How does OpenId work") I realize this question is somewhat of a duplicate, and yes, I have read the spec and the wikipedia article. After reading the materials mentioned above, I still don't have a complete picture in my head of how each step in the process is...
To design and implement OpenID components effectively, it’s essential to have a clear understanding of the OpenID workflow, the components involved, and how they interact. Below is an overview of the process along with steps to implement OpenID using a library such as DotNetOpenID. ### OpenID Workflow Overview 1. **...
15,193
[ { "from": "human", "value": "How would you design and implement OpenID components?\n(Was \"How does OpenId work\")\nI realize this question is somewhat of a duplicate, and yes, I have read the spec and the wikipedia article.\nAfter reading the materials mentioned above, I still don't have a complete picture...
I'm writing some code for a class constructor which loops through all the properties of the class and calls a generic static method which populates my class with data from an external API. So I've got this as an example class: public class MyClass{ public string Property1 { get; set; } public int Property2 { get; s...
To achieve the desired functionality of calling a generic static method and passing the property type dynamically in your constructor, you can use reflection to get the property type and then use that type to invoke your generic method. Here's how you can do it: 1. Use `PropertyInfo.PropertyType` to get the type of th...
18,974
[ { "from": "human", "value": "I'm writing some code for a class constructor which loops through all the properties of the class and calls a generic static method which populates my class with data from an external API. So I've got this as an example class:\npublic class MyClass{\n public string Property1 { ...
I'm about to push out a website soon and so I've gotten in the last stages. Time to optimize the baby! The website performs pretty good overall, with an average framerate of 32fps. But at some heavy animation parts it likes to drop a couple of frames to about 22fps. Which is not that horrible. But I'm tweaking it as mu...
It sounds like you're already on the right track with some solid optimization techniques! Here are some additional tips and tricks that may help improve the performance of your website, especially when dealing with animations and heavy graphical elements: ### General Performance Tips 1. **Use CSS Transitions/Animatio...
18,966
[ { "from": "human", "value": "I'm about to push out a website soon and so I've gotten in the last stages. Time to optimize the baby! The website performs pretty good overall, with an average framerate of 32fps. But at some heavy animation parts it likes to drop a couple of frames to about 22fps. Which is not...
Unless I am missing an obvious built-in method, what is the quickest way to get the nth occurrence of a string within a string? I realize that I could loop the IndexOf method by updating its start index on each iteration of the loop. But doing it this way seems wasteful to me.
You're correct that one common approach to find the nth occurrence of a substring in a string is to loop through using the `IndexOf` method, updating the starting index for each iteration. While this method is simple and straightforward, it might not seem efficient. However, if you're looking for a more elegant soluti...
18,954
[ { "from": "human", "value": "Unless I am missing an obvious built-in method, what is the quickest way to get the nth occurrence of a string within a string?\nI realize that I could loop the IndexOf method by updating its start index on each iteration of the loop. But doing it this way seems wasteful to me.\...
When I am adding two textbox values that are 1.001 and 0.001 and then I do a parseFloat I get 1.0019999999. I want it 1.002 . Can you help me?
The issue you're experiencing is due to how floating-point arithmetic works in JavaScript (and many other programming languages). Floating-point numbers can sometimes have precision issues, leading to unexpected results when performing arithmetic. To get around this and ensure you have the correct result, you can roun...
15,263
[ { "from": "human", "value": "When I am adding two textbox values that are 1.001 and 0.001 and then I do a parseFloat I get 1.0019999999. I want it 1.002 . Can you help me?\n" }, { "from": "gpt", "value": "The issue you're experiencing is due to how floating-point arithmetic works in JavaScript (...
How do I set the initial width of a QDockWidget? I have implemented the sizeHint function but what next?
In a Qt application, to set the initial width of a `QDockWidget`, you have a couple of options. Implementing the `sizeHint()` function is a good approach because it helps provide a default size for the widget based on its content. However, you also need to set the initial size of the `QDockWidget` when it is shown for ...
17,943
[ { "from": "human", "value": "How do I set the initial width of a QDockWidget?\nI have implemented the sizeHint function but what next?\n" }, { "from": "gpt", "value": "In a Qt application, to set the initial width of a `QDockWidget`, you have a couple of options. Implementing the `sizeHint()` fu...
Does anyone know of any reverse proxy solutions that allow the content/data of an HTTP response to be directly modified before being relayed to the requesting client? As an example: Proxy relays client request for pdf document to another server, response received by proxy, watermark added to pages of pdf, watermarked p...
Yes, there are several reverse proxy solutions and libraries that allow you to modify HTTP responses before they are sent back to the client. Here are a few options that could suit your needs for adding a watermark to PDF documents: ### 1. **Nginx with Lua Module** Nginx can be used as a reverse proxy, and with the he...
19,516
[ { "from": "human", "value": "Does anyone know of any reverse proxy solutions that allow the content/data of an HTTP response to be directly modified before being relayed to the requesting client?\nAs an example:\nProxy relays client request for pdf document to another server, response received by proxy, wat...
I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows vista business 32bit. I tried to install everything manually (one thing at a time, apache, postgresql and php (all the latest stable releases)) and after I get everything up and running. Whenever I try to run a script on my mac...
The issue you're encountering is a common one when PHP is not properly configured to run with Apache. When the server cannot parse PHP files, it typically prompts to download them instead of executing them. Here's how to troubleshoot and fix the problem step by step: ### Step 1: Check Apache Configuration 1. **Locate...
17,736
[ { "from": "human", "value": "I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows vista business 32bit. I tried to install everything manually (one thing at a time, apache, postgresql and php (all the latest stable releases)) and after I get everything up and running....
I have a file. I want to get its contents into a blob column in my oracle database or into a blob variable in my PL/SQL program. What is the best way to do that?
To insert the contents of a file into a BLOB column in an Oracle database, you can use either a PL/SQL program or SQL commands along with Oracle's built-in features for handling BLOB data. Below are two methods: one using PL/SQL and another using SQL commands. ### Method 1: Using PL/SQL to Insert into a BLOB Column Y...
12,526
[ { "from": "human", "value": "I have a file. I want to get its contents into a blob column in my oracle database or into a blob variable in my PL/SQL program. What is the best way to do that?\n" }, { "from": "gpt", "value": "To insert the contents of a file into a BLOB column in an Oracle databas...
My Delphi7 project will not run on my clients computer if i don't have a few of the runtime packages in the path. eg rtl70.bpl I have Build with runtime packages unticked, so shouldn't they be complied into the exe? Edit: the Project uses Jedi Packages (TJvPlugin) and running the program with out any plugin installed w...
When you encounter issues with runtime packages in Delphi 7, there are a few key points to consider: 1. **Build with Runtime Packages**: If you have the "Build with runtime packages" option unchecked, the compiler should statically link the necessary units and classes into the executable (EXE). However, if your projec...
19,105
[ { "from": "human", "value": "My Delphi7 project will not run on my clients computer if i don't have a few of the runtime packages in the path. eg rtl70.bpl\nI have Build with runtime packages unticked, so shouldn't they be complied into the exe?\nEdit: the Project uses Jedi Packages (TJvPlugin) and running ...
A sample perl script that connects to an oracle database, does a simple SELECT query, and spits the results to stdout in CSV format would be great. Python or any other language available in a typical unix distribution would be fine too. Note that I'm starting from scratch with nothing but a username/password for a r...
Certainly! Below are examples in Perl, Python, and Mathematica to connect to an Oracle database and execute a SELECT query, returning results in CSV format. ### Perl Example You need the `DBI` and `DBD::Oracle` Perl modules to connect to the Oracle database. Make sure you have them installed. You can install them usi...
15,369
[ { "from": "human", "value": "A sample perl script that connects to an oracle database, does a simple SELECT query, and spits the results to stdout in CSV format would be great. Python or any other language available in a typical unix distribution would be fine too. \nNote that I'm starting from scratch wi...
My company runs a webmail service, and we were trying to diagnose a problem with Word downloads not opening automatically - the same *.doc file download from Yahoo Mail would open, but one from ours would not. In the course of investigating the headers we saw this coming from Yahoo: content-disposition attachment; file...
The additional asterisk and `utf-8''` designation in the `Content-Disposition` header, as seen in the Yahoo Mail header, is part of a mechanism called "RFC 5987" encoding for the `filename` parameter. Here's a breakdown of what's happening: 1. **Standard Content-Disposition Header**: The standard `Content-Disposit...
19,659
[ { "from": "human", "value": "My company runs a webmail service, and we were trying to diagnose a problem with Word downloads not opening automatically - the same *.doc file download from Yahoo Mail would open, but one from ours would not.\nIn the course of investigating the headers we saw this coming from Y...
I have some data grouped in a table by a certain criteria, and for each group it is computed an average —well, the real case is a bit more tricky— of the values from each of the detail rows that belong to that group. This average is shown in each group footer rows. Let's see this simple example: What I want now is to ...
When working with grouped data and needing to calculate a grand total of averages, you cannot directly nest aggregate functions. Instead, you will need to follow a two-step approach to achieve your desired grand total. Here's how you can do it: 1. **Calculate Group Averages**: First, make sure that you have calculate...
20,916
[ { "from": "human", "value": "I have some data grouped in a table by a certain criteria, and for each group it is computed an average —well, the real case is a bit more tricky— of the values from each of the detail rows that belong to that group. This average is shown in each group footer rows. Let's see thi...
If I had a Canvas with n number of Visual objects of any shape or size, how would I highlight/outline a Visual object programmatically? Is there something built into WPF to help me?
In WPF (Windows Presentation Foundation), you can highlight or outline a visual object programmatically using various approaches depending on the type of visual object you are dealing with. Here are a few common methods to achieve this: ### 1. **Using a Border** If your visual object is a shape or a control, you can ...
17,320
[ { "from": "human", "value": "If I had a Canvas with n number of Visual objects of any shape or size, how would I highlight/outline a Visual object programmatically? \nIs there something built into WPF to help me? \n" }, { "from": "gpt", "value": "In WPF (Windows Presentation Foundation), you can...
I want to attach a click event to a button element and then later remove it, but I can't get unclick() or unbind() event(s) to work as expected. In the code below, the button is tan colour and the click event works. window.onload = init; function init() { $("#startButton").css('background-color', 'beige').click(p...
To remove a click event that has been attached to an element using jQuery, you should use the `.off()` method. In your code, you are trying to use `unclick()`, which is not a valid jQuery method. Also, `.unbind()` is an older method that has been deprecated in favor of `.off()`. Here's how you can properly add and the...
18,265
[ { "from": "human", "value": "I want to attach a click event to a button element and then later remove it, but I can't get unclick() or unbind() event(s) to work as expected. In the code below, the button is tan colour and the click event works.\nwindow.onload = init; \nfunction init() {\n $(\"#startButt...
Question Using XSLT 1.0, given a string with arbitrary characters how can I get back a string that meets the following rules. First character must be one of these: a-z, A-Z, colon, or underscore All other characters must be any of those above or 0-9, period, or hyphen If any character does not meet the above rules, re...
To achieve your goal of ensuring that a string adheres to a set of defined rules for valid characters in an XSLT 1.0 context, you'll have to manually iterate over the string, validating each character against your defined whitelist. Since XSLT 1.0 does not have built-in support for regular expressions or similar comple...
16,540
[ { "from": "human", "value": "Question\nUsing XSLT 1.0, given a string with arbitrary characters how can I get back a string that meets the following rules.\n\nFirst character must be one of these: a-z, A-Z, colon, or underscore\nAll other characters must be any of those above or 0-9, period, or hyphen\nIf a...
I have had to do this several times, usually when trying to find in what files a variable or a function is used. I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways.
Yes, there are several easier and more efficient ways to search for variables or functions in files, especially if you’re working in a programming environment. Here are some alternatives to using `xargs` with `grep`: ### 1. **Using `grep` directly** If you want to search through multiple files, you can use `grep` with...
19,225
[ { "from": "human", "value": "I have had to do this several times, usually when trying to find in what files a variable or a function is used.\nI remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways.\n" }, { "from": "gpt", "value": "Yes, there are...
I'm looking for a very specific eclipse plugin that will tell me if a class in my project is not implementing hashCode or/and equals methods. Does anyone know of such a plugin? Thanks
Yes, there are several Eclipse plugins and tools that can help you identify classes that do not implement the `hashCode` or `equals` methods. Here are a couple of options you can consider: 1. **SonarLint**: This is a popular plugin that provides on-the-fly feedback about bugs and code quality issues in your Eclipse ID...
19,473
[ { "from": "human", "value": "I'm looking for a very specific eclipse plugin that will tell me if a class in my project is not implementing hashCode or/and equals methods.\nDoes anyone know of such a plugin?\nThanks\n" }, { "from": "gpt", "value": "Yes, there are several Eclipse plugins and tools...
I just came across this code and a few Google searches turn up no explanation of this mysterious (to me) syntax. Hashtable^ tempHash = gcnew Hashtable(iterators_); IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator(); What the heck does the caret mean? (The gcnew is also new to me, and I asked about that her...
The caret symbol (`^`) in your code is specific to C++/CLI, which is a version of C++ designed for interoperability with the .NET framework. Here's a breakdown of what you're seeing: 1. **Caret (`^`)**: In C++/CLI, the caret is used to denote a handle to a managed object. Managed objects are those that are part of the...
19,004
[ { "from": "human", "value": "I just came across this code and a few Google searches turn up no explanation of this mysterious (to me) syntax.\nHashtable^ tempHash = gcnew Hashtable(iterators_);\n\nIDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();\n\nWhat the heck does the caret mean? (The gcnew...
I'm playing around with the <canvas> element, drawing lines and such. I've noticed that my diagonal lines are antialiased. I'd prefer the jaggy look for what I'm doing - is there any way of turning this feature off?
The `<canvas>` element in HTML5 uses the browser's graphics rendering engine, which typically employs anti-aliasing by default to smooth out the edges of shapes and lines. Unfortunately, there is no direct way to turn off anti-aliasing within the `<canvas>` context itself. However, there are a few workarounds you can t...
18,432
[ { "from": "human", "value": "I'm playing around with the <canvas> element, drawing lines and such.\nI've noticed that my diagonal lines are antialiased. I'd prefer the jaggy look for what I'm doing - is there any way of turning this feature off?\n" }, { "from": "gpt", "value": "The `<canvas>` el...
I always use unix timestamps for everything, but am wondering if there is a better way. What do you use to store timestamps and why?
Using Unix timestamps is a common and effective way to handle dates and times in many programming and database contexts. However, whether it's the best choice depends on your specific use case. Here are some alternatives to consider, along with their advantages and disadvantages: ### 1. **ISO 8601 Format** - **What It...
18,119
[ { "from": "human", "value": "I always use unix timestamps for everything, but am wondering if there is a better way.\nWhat do you use to store timestamps and why?\n" }, { "from": "gpt", "value": "Using Unix timestamps is a common and effective way to handle dates and times in many programming an...
In VxWorks, I can display global variables in the shell like so: -> my_global my_global = 0x103c4110: value = 4 = 0x4 Is there a way to do the same with a RTP global variable?
In VxWorks, when you're working with Real-Time Processes (RTP), displaying global variables is slightly different compared to displaying global variables in the kernel shell. Since RTPs are isolated processes, you need to access the RTP's memory space to inspect its global variables. To display global variables from a...
21,152
[ { "from": "human", "value": "In VxWorks, I can display global variables in the shell like so:\n\n-> my_global\nmy_global = 0x103c4110: value = 4 = 0x4\n\nIs there a way to do the same with a RTP global variable?\n" }, { "from": "gpt", "value": "In VxWorks, when you're working with Real-Time Proc...
Was wondering if anyone knows, or has pointers to good documentation that discusses, the low-level implementation details of Cocoa's 'performSelectorOnMainThread:' method. My best guess, and one I think is probably pretty close, is that it uses mach ports or an abstraction on top of them to provide intra-thread communi...
The `performSelectorOnMainThread:` method in Cocoa is indeed a higher-level abstraction for scheduling messages (selectors) to be executed on the main thread. While your guess about Mach ports might be in the right direction regarding inter-thread communication, the actual implementation in Cocoa is a bit more complex ...
18,278
[ { "from": "human", "value": "Was wondering if anyone knows, or has pointers to good documentation that discusses, the low-level implementation details of Cocoa's 'performSelectorOnMainThread:' method.\nMy best guess, and one I think is probably pretty close, is that it uses mach ports or an abstraction on t...
I need to do some communications over a serial port in Ruby. From my research, it appears that there aren't many modern libraries for serial communications and the newest material I can find is from 2006. Are there any gems that I'm not aware of? I ultimately need to maintain communications with a serial device attac...
You're correct that there aren't many modern libraries specifically for serial communication in Ruby, but there are a few gems that can help you accomplish this task effectively. One of the most widely used gems for serial communication in Ruby is `rubyserial`. This gem provides a simple interface to communicate with s...
16,807
[ { "from": "human", "value": "I need to do some communications over a serial port in Ruby. From my research, it appears that there aren't many modern libraries for serial communications and the newest material I can find is from 2006. Are there any gems that I'm not aware of?\nI ultimately need to maintain...
My "Start debugging" button and element menu are greyed out... but only on one of my projects (an ASP.NET website). I have no idea what I have done to disable it. I already checked everything in the Property page of both the solution and project. I even compared it to another project, but nothing seems to do the trick....
If the "Start Debugging" button and the element menu are greyed out for a specific ASP.NET project, it could be caused by a few different issues. Here are some steps you can take to troubleshoot and hopefully resolve the problem: 1. **Check Project Configuration**: - Right-click on the project in Solution Explorer ...
17,590
[ { "from": "human", "value": "My \"Start debugging\" button and element menu are greyed out... but only on one of my projects (an ASP.NET website). I have no idea what I have done to disable it.\nI already checked everything in the Property page of both the solution and project. I even compared it to another...
I'm just meddling in the ways of the RESTful web service in C# using ASP.Net 2.0 and have managed (via a class library, a reference to dll produced by the former and some adjustment of my web.config) to coax out a URI format like so: http: //localhost/DevelopmentProject/testhandler/?input=thisismyinput Which unremarka...
To achieve the desired URI format of `http://localhost/DevelopmentProject/testhandler/thisismyinput` instead of `http://localhost/DevelopmentProject/testhandler/?input=thisismyinput`, you'll need to adjust the way you're handling the routing in your HTTP handler in ASP.NET. Here's a step-by-step approach to achieve th...
13,122
[ { "from": "human", "value": "I'm just meddling in the ways of the RESTful web service in C# using ASP.Net 2.0 and have managed (via a class library, a reference to dll produced by the former and some adjustment of my web.config) to coax out a URI format like so:\nhttp: //localhost/DevelopmentProject/testha...