instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I've been trying to preserve the state of my iPhone application by serializing my main UITabBarController using [NSKeyedArchiver archiveRootObject:toFile:], but I'm running into difficulties. First I had a problem with UIImage, since it doesn't implement the NSCoding protocol, but I solved that by making an extension c...
Preserving the state of your iPhone application by archiving a `UITabBarController` with its nested `UINavigationController`s can be tricky, especially because not all UIKit classes are directly archiveable using `NSKeyedArchiver`. Here are some points to consider to help you successfully serialize and restore your app...
43,240
[ { "from": "human", "value": "I've been trying to preserve the state of my iPhone application by serializing my main UITabBarController using [NSKeyedArchiver archiveRootObject:toFile:], but I'm running into difficulties.\nFirst I had a problem with UIImage, since it doesn't implement the NSCoding protocol, ...
As you can see below, in the constructor I'm instantiating a validation object so I can validate a user's email in a set method. Is this architecture best practice or flawed? Can I avoid making my User class directly dependent on my Validation class? Class User { Private Email //constructor User() { Validation = n...
Your concerns regarding the architecture of the `User` class and its dependence on the `Validation` class, as well as the appropriate response when invalid values are passed, are important to consider for maintainability and robustness. ### Dependency on Validation Class 1. **Direct Dependency**: By directly instanti...
43,175
[ { "from": "human", "value": "As you can see below, in the constructor I'm instantiating a validation object so I can validate a user's email in a set method. Is this architecture best practice or flawed? Can I avoid making my User class directly dependent on my Validation class?\nClass User {\n Private Ema...
The DB load on my site is getting really high so it is time for me to cache common queries that are being called 1000s of times an hour where the results are not changing. So for instance on my city model I do the following: def self.fetch(id) Rails.cache.fetch("city_#{id}") { City.find(id) } end def after_...
Caching is a great way to optimize your application and reduce database load, especially for frequently accessed data that doesn't change often. In your case, it sounds like you want to cache the entire City object, so that any access to a user’s city will benefit from caching. Here are some approaches you can consider...
41,557
[ { "from": "human", "value": "The DB load on my site is getting really high so it is time for me to cache common queries that are being called 1000s of times an hour where the results are not changing. \nSo for instance on my city model I do the following: \ndef self.fetch(id) \n Rails.cache.fetch(\"city_...
We have an old system running on a WinServer2003 R2 - IIS6 and it was written using classic ASP. We need to trap all errors and for that, I configured IIS to redirect 404s and 500s to a custom page (custom errors config) that writes the info to a log file (this page creates and manages the logs). Here is the weird thin...
It sounds like you're experiencing a classic issue with ASP error handling in IIS 6. When an error occurs, IIS may cache the error response, which can cause the behavior you're seeing where subsequent requests for the same error return a blank page instead of your custom error page. Here are some steps you can take to ...
42,231
[ { "from": "human", "value": "We have an old system running on a WinServer2003 R2 - IIS6 and it was written using classic ASP.\nWe need to trap all errors and for that, I configured IIS to redirect 404s and 500s to a custom page (custom errors config) that writes the info to a log file (this page creates and...
say I have an asynchronous library, written in native C++, with an interface similar to this: class connection { public: boost::signal< void() > sig_connection_made; boost::signal< void(const std::string&) > sig_error; void connect(const std::string& host, const std::string& port); }; that I want to wrap ...
Wrapping a native C++ library with a signal/slot mechanism (like Boost.Signals) into C# using SWIG can be a bit challenging since SWIG does not directly support Boost.Signals. However, you can create a workaround by using a combination of custom SWIG typemaps and C# delegates to achieve the desired behavior. Here’s a ...
38,574
[ { "from": "human", "value": "say I have an asynchronous library, written in native C++, with an interface similar to this:\nclass connection {\npublic:\n boost::signal< void() > sig_connection_made;\n boost::signal< void(const std::string&) > sig_error;\n\n void connect(const std::string& host, con...
So I've got a nice Java project, build with Ant to a /dist folder. The whole project is under version control, so I can deploy the latest version just by 'svn export' on the path to the dist folder. But my build keeps deleting the .svn folders inside my dist folder, and all its dependents, because it cleans out the fol...
You're encountering a common issue with using Ant to build a project when the output directory is also under version control. Here are a few strategies you can use to resolve the problem: ### 1. Use a Different Build Directory One of the simplest solutions is to change the output directory of your Ant build to a locat...
40,786
[ { "from": "human", "value": "So I've got a nice Java project, build with Ant to a /dist folder.\nThe whole project is under version control, so I can deploy the latest version just by 'svn export' on the path to the dist folder.\nBut my build keeps deleting the .svn folders inside my dist folder, and all it...
MS is calling Azure an Operating System. To me, it feels much more like a framework. I am having a bit of trouble defining the two separately. I have a general intuition, but I am not articulate enough to really say if Azure is really an OS or just a framework sitting on top of Operating Systems.
It's understandable to find it challenging to define the distinction between an operating system (OS) and a framework, especially in the context of cloud computing platforms like Microsoft Azure. Let's break down the definitions and roles of both: ### Operating System (OS) 1. **Definition**: An operating system is sy...
41,575
[ { "from": "human", "value": "MS is calling Azure an Operating System. \nTo me, it feels much more like a framework. I am having a bit of trouble defining the two separately. I have a general intuition, but I am not articulate enough to really say if Azure is really an OS or just a framework sitting on to...
I am trying to make a form in which the user fills in values. It is quite long. I wish to use an expandable tree to fit it into my one form. Is there any way to give each TreeView Node a TextBox by its side? Having the node text edited by itself is not enough.
Yes, you can certainly create a form that utilizes an expandable tree structure (like a TreeView) where each node has an associated TextBox or similar input field. This can be done using a combination of a `TreeView` control and a `Panel` or custom layout to hold the `TextBox` alongside each node. Here is a general ap...
42,670
[ { "from": "human", "value": "I am trying to make a form in which the user fills in values. It is quite long. I wish to use an expandable tree to fit it into my one form. Is there any way to give each TreeView Node a TextBox by its side? Having the node text edited by itself is not enough.\n" }, { "f...
I recently posted a question about Azure... is it really an OS? I understand the technical details, and I got a lot of fuzzy answers... I really want to know... what do you think is the difference between an OS and a Framework? Just for reference, Azure will be built on top of Hyper-V servers and the virtual machines ...
The distinction between an operating system (OS) and a framework can sometimes be nuanced, especially in the context of cloud platforms like Azure. Here’s a breakdown of both concepts and how they differ: ### Operating System (OS) 1. **Definition**: An OS is a fundamental software layer that manages hardware resource...
41,652
[ { "from": "human", "value": "I recently posted a question about Azure... is it really an OS? I understand the technical details, and I got a lot of fuzzy answers... I really want to know... what do you think is the difference between an OS and a Framework?\nJust for reference, Azure will be built on top of...
I've read the several discussions about storing code snippets but I did't find the info that I'm looking for, so let's define it: At home, I have several side projects, most of them quite small, one large, and numerous little examples that demonstrate a specific language feature (for example, some template trick in C+...
Storing and organizing code snippets effectively can enhance productivity and make it easier to reference important examples when you need them. Here are some ideas and best practices that can help you organize your code snippets and small projects: ### 1. Use a Version Control System - **Git**: Store your snippets an...
40,333
[ { "from": "human", "value": "I've read the several discussions about storing code snippets but I did't find the info that I'm looking for, so let's define it:\n\nAt home, I have several side projects, most of them quite small, one large, and numerous little examples that demonstrate a specific language feat...
I'm writing a basic planet viewer OpenGL Perl application, just for fun. I have the basics working, with the glorious planet, implemented through a gluSphere(), rotating with the classic earth texture map applied. Now, what if I want to apply a second texture map through OpenGL (say, the "earth clouds")? Of course, I c...
Yes, you can apply multiple textures to an object in OpenGL using texture coordination techniques. To achieve the effect of combining a planet texture (e.g., an Earth texture) with a second texture (e.g., cloud textures), you can use multi-texturing capabilities provided by OpenGL. Here's how you can implement this in ...
42,093
[ { "from": "human", "value": "I'm writing a basic planet viewer OpenGL Perl application, just for fun.\nI have the basics working, with the glorious planet, implemented through a gluSphere(), rotating with the classic earth texture map applied.\nNow, what if I want to apply a second texture map through OpenG...
I often want to trigger a certain function just once, but I need to trigger it from within another function that gets repeatedly called. For instance, taking a snapshot of something for later use. I usually do it by setting a global boolean. I'm wondering whether the way I do it is actually best way? I seem to recall ...
It's great to hear that you’ve found an improved solution to your problem! Using a boolean flag to ensure a function is triggered only once is a common pattern in programming. However, there are often more flexible and robust alternatives you might consider, depending on the specific context and requirements of your ap...
43,338
[ { "from": "human", "value": "I often want to trigger a certain function just once, but I need to trigger it from within another function that gets repeatedly called. For instance, taking a snapshot of something for later use. I usually do it by setting a global boolean.\nI'm wondering whether the way I do i...
I have the following div layout: Everything is fine when I put normal txt elements in both the blue and the orange div. However, when I place an image in the orange div (which is 31px), the elements in the blue div get pushed down by about half the height of the blue div. (additional info, when hovering over the html ...
It sounds like you're experiencing a common issue related to how images interact with their containing elements and the CSS box model. When an image is placed inside a div (in this case, the orange div), its behavior can sometimes cause unexpected layout shifts, especially if there are issues with vertical alignment, m...
42,228
[ { "from": "human", "value": "I have the following div layout:\n\nEverything is fine when I put normal txt elements in both the blue and the orange div. However, when I place an image in the orange div (which is 31px), the elements in the blue div get pushed down by about half the height of the blue div.\n(a...
With generics, is there ever a reason to create specific derived EventArg classes It seems like now you can simply use them on the fly with a generic implementation. Should i go thorugh all of my examples and remove my eventArg classes (StringEventArgs, MyFooEventArgs, etc . .) public class EventArgs<T> : EventArgs { ...
Using generics for event arguments in .NET is a flexible and powerful approach, but whether to use specific derived `EventArgs` classes or a generic implementation depends on your specific requirements, code clarity, maintainability, and the expected usage of the events in your application. Here are some considerations...
42,463
[ { "from": "human", "value": "With generics, is there ever a reason to create specific derived EventArg classes\nIt seems like now you can simply use them on the fly with a generic implementation.\nShould i go thorugh all of my examples and remove my eventArg classes (StringEventArgs, MyFooEventArgs, etc . ....
I'm working on a database that tracks files and dependencies in projects. Briefly, I have two main tables; the PROJECTS table lists project names and other properties, the FILES table lists files. Every file entry points to a project as a foreign key set to CASCADE, so if I delete a project record from the database, al...
You’re encountering a common issue with cascading deletes and foreign key constraints, especially when using a mixture of `CASCADE` and `RESTRICT` actions. Firebird (as well as many other relational databases) enforces the integrity of the relationships in a way that can complicate cascading deletes in a multi-table se...
42,596
[ { "from": "human", "value": "I'm working on a database that tracks files and dependencies in projects. Briefly, I have two main tables; the PROJECTS table lists project names and other properties, the FILES table lists files. Every file entry points to a project as a foreign key set to CASCADE, so if I dele...
We have built some .NET controls, and we are using them as COM controls in a PowerBuilder application. They (mostly) consist of controls with other controls on them, some other of our custom controls, some from DevExpress. All of ours inherit from a common base - and this has the DevExpress LookAndFeel control on to en...
It sounds like you are encountering a common issue when using .NET controls in a COM context like PowerBuilder. The behavior you are observing, where the `BackColor` of the controls appears as white instead of the expected system color, can occur for several reasons: ### Potential Causes and Solutions: 1. **PowerBuil...
42,173
[ { "from": "human", "value": "We have built some .NET controls, and we are using them as COM controls in a PowerBuilder application.\nThey (mostly) consist of controls with other controls on them, some other of our custom controls, some from DevExpress. All of ours inherit from a common base - and this has t...
In C#4.0 we're going to get dynamic types, or objects whose "static type is dynamic", according to Anders. This will allow any method invocation resolution to happen at runtime rather than compile time. But will there be facility to bind the dynamic object to some sort of contract (and thereby also get full intellisens...
In C# 4.0, the `dynamic` type was introduced, allowing for late binding and greater flexibility in handling types at runtime. However, it does not provide built-in mechanisms to enforce contracts directly on dynamic objects for intellisense or compile-time safety. The scenario you described, where you want to convert ...
41,269
[ { "from": "human", "value": "In C#4.0 we're going to get dynamic types, or objects whose \"static type is dynamic\", according to Anders. This will allow any method invocation resolution to happen at runtime rather than compile time. But will there be facility to bind the dynamic object to some sort of cont...
I am trying to create a new website on a remote server via msbuild (I like to call it "msdeploy"). I've downloaded and used the SDC tasks, the MSBuildExtension tasks and the MSBuildCommunity tasks but I simply can't get it right. I figure that WebDirectorySetting (from MSBuild.Community.Tasks.IIS) is my best bet but I...
Creating a new website on a remote server using MSBuild can indeed be a bit tricky, especially if you're trying to use existing tasks and libraries. Below are some steps and considerations that may help you achieve your goal using MSBuild. ### Option 1: Using MSBuild.Community.Tasks The `MSBuild.Community.Tasks` libr...
42,723
[ { "from": "human", "value": "I am trying to create a new website on a remote server via msbuild (I like to call it \"msdeploy\"). I've downloaded and used the SDC tasks, the MSBuildExtension tasks and the MSBuildCommunity tasks but I simply can't get it right.\nI figure that WebDirectorySetting (from MSBui...
I am in need of a case insensitive string enumeration type in my XML schema (.xsd) file. I can get case insensitive by doing the following. <xs:simpleType name="setDigitalPointType"> <xs:restriction base="xs:string"> <xs:pattern value="[Oo][Nn]" /> <xs:pattern value="[Oo][Ff][Ff]" /> </xs:restri...
In XML Schema (XSD), there is currently no direct way to create a case-insensitive enumeration that still provides the benefits of intellisense and validation through enumerated values. However, you can achieve the desired outcome by using a combination of `xs:restriction` for enumerations and `xs:pattern` for case-ins...
44,073
[ { "from": "human", "value": "I am in need of a case insensitive string enumeration type in my XML schema (.xsd) file. I can get case insensitive by doing the following.\n<xs:simpleType name=\"setDigitalPointType\">\n <xs:restriction base=\"xs:string\">\n <xs:pattern value=\"[Oo][Nn]\" />\n ...
Is there a USB HID pen driver in Windows Vista? If so, what are the requirements for USB descriptors, in order to make Windows Vista recognize the pen and load the pen driver? What I'm searching for is the pen equivalent to the HID mouse driver, HID keyboard driver and mass storage driver. The mentioned example driver...
To ensure that Windows Vista recognizes your USB HID pen device and loads the appropriate pen driver (rather than just the generic HID driver), you need to adhere to the USB HID specifications and use the correct HID usage tables and descriptors for pen devices. ### Requirements for USB Descriptors 1. **HID Usage Tab...
40,236
[ { "from": "human", "value": "Is there a USB HID pen driver in Windows Vista? \nIf so, what are the requirements for USB descriptors, in order to make Windows Vista recognize the pen and load the pen driver?\nWhat I'm searching for is the pen equivalent to the HID mouse driver, HID keyboard driver and mass s...
I'm interested in reading about the various ways other developers and architects deal with the customization of certain areas of their applications for certain sites. Call outs to customer implemented pre and post processing, events doing the same, allowing business logic methods to be overridden, using strategies wit...
When dealing with the customization of applications for specific clients or sites without creating customer-specific code branches, there are several strategies that developers and architects commonly employ. Below, I’ll outline various approaches, their pros and cons, and some real-world applications. ### 1. **Pre an...
36,301
[ { "from": "human", "value": "I'm interested in reading about the various ways other developers and architects deal with the customization of certain areas of their applications for certain sites. Call outs to customer implemented pre and post processing, events doing the same, allowing business logic metho...
I have seen a lot of ob_get_clean() the last while. Typically I have done $test .= 'test' I'm wondering if one is faster and/or better than the other. Here is the code using ob_get_clean(): ob_start(); foreach($items as $item) { echo '<div>' . $item . '</div>'; } $test = ob_get_clean(); Here is the code using $t...
Both methods you've shown for concatenating output in PHP have their pros and cons, and the choice between them can depend on specific use cases, performance considerations, and coding style preferences. Here's a breakdown of each approach: ### Method 1: Using Output Buffering (`ob_get_clean()`) ```php ob_start(); f...
43,547
[ { "from": "human", "value": "I have seen a lot of ob_get_clean() the last while. Typically I have done $test .= 'test'\nI'm wondering if one is faster and/or better than the other.\nHere is the code using ob_get_clean():\nob_start();\n\nforeach($items as $item) {\n echo '<div>' . $item . '</div>';\n}\n\n...
I'm looking for way to grab the content of my opengl (as UIImage) and then save it into a file. I'm now giving glReadPixels a try though I'm not sure I'm doing the right thing as of what kind of malloc I should be doing. I gather that on OSX it's GL_BGRA but on the iPhone that doesn't work...
To capture the content of your OpenGL rendering context into a `UIImage` on iOS, you can indeed use `glReadPixels`. The idea is to read the pixels from the OpenGL buffer and convert them into a format that can be used as a `UIImage`. Below is a step-by-step guide on how to achieve this: ### Step 1: Set up a buffer t...
36,791
[ { "from": "human", "value": "I'm looking for way to grab the content of my opengl (as UIImage) and then save it into a file. I'm now giving glReadPixels a try though I'm not sure I'm doing the right thing as of what kind of malloc I should be doing. I gather that on OSX it's GL_BGRA but on the iPhone that d...
I have a project where I have to interact with two different devices that supply data via COM over USB. The client is telling me that this can be done easily with HyperTerminal but I am unfamiliar with it. I am coding with .NET 2.0 (but can use 3.5 if necessary). What would be the easiest/quickest way to obtain the dat...
To interact with devices over COM ports in .NET, you can utilize the `System.IO.Ports.SerialPort` class, which is part of the .NET Framework. This is a standard approach and will allow you to easily read and write data to your devices connected via USB (using COM ports). Here's a basic overview of how you can use the...
39,667
[ { "from": "human", "value": "I have a project where I have to interact with two different devices that supply data via COM over USB. The client is telling me that this can be done easily with HyperTerminal but I am unfamiliar with it. I am coding with .NET 2.0 (but can use 3.5 if necessary).\nWhat would be ...
I want to test my Entities that are built using Entity Framework. My concern is that using Entity Framework means directly working with data source. So any ideas how to unit testing Entity Framework based components?
Unit testing components that use Entity Framework can be a bit tricky due to the tight coupling with the database. However, there are strategies you can use to effectively unit test your Entity Framework-based components while avoiding direct interaction with the actual database. Here are some approaches you can consid...
40,664
[ { "from": "human", "value": "I want to test my Entities that are built using Entity Framework.\nMy concern is that using Entity Framework means directly working with data source.\nSo any ideas how to unit testing Entity Framework based components?\n" }, { "from": "gpt", "value": "Unit testing co...
I know, it depends on the webapp. But in the normal case, what do you do: one servlet, that serves different pages (like an standalone-application with changing content) or for every page a single servlet. Take for instance a blog. There is the start-page with the most recent blog-entries, an article-view for displayin...
When designing a web application using servlets, there are a few common approaches you could take, particularly for a blog application that has multiple views like a start page, an article view, and an archive. Let's look at the two approaches you've mentioned: ### 1. Single Servlet for Multiple Pages In this approach...
39,390
[ { "from": "human", "value": "I know, it depends on the webapp. But in the normal case, what do you do: one servlet, that serves different pages (like an standalone-application with changing content) or for every page a single servlet.\nTake for instance a blog. There is the start-page with the most recent b...
I am currently trying to access a network share from my machine programaticaly using vc++ 6.0. I am using WNetAddConnection2 to connect to a share using my credentials. I am facing the following problem: Consider the case when there are 2 users trying to access the same remote share from same machine one after the oth...
When you encounter issues with accessing network shares simultaneously with different credentials on the same machine, it typically relates to the way Windows handles network connections. When one user connects to a share, their credentials become cached, and subsequent connections using different credentials may eithe...
41,534
[ { "from": "human", "value": "I am currently trying to access a network share from my machine programaticaly using vc++ 6.0. I am using WNetAddConnection2 to connect to a share using my credentials. \nI am facing the following problem:\nConsider the case when there are 2 users trying to access the same remot...
Is there a way to cancel a pending operation (without disconnect) or set a timeout for the boost library functions? I.e. I want to set a timeout on blocking socket in boost asio? socket.read_some(boost::asio::buffer(pData, maxSize), error_); Example: I want to read some from the socket, but I want to throw an error if ...
In Boost.Asio, you can set a timeout for blocking operations by using a combination of asynchronous operations and timers. Since `socket.read_some()` is a blocking call, you can achieve your goal by using an asynchronous read along with a timer that cancels the read operation if it takes too long. Here's an example of...
42,762
[ { "from": "human", "value": "Is there a way to cancel a pending operation (without disconnect) or set a timeout for the boost library functions?\nI.e. I want to set a timeout on blocking socket in boost asio?\nsocket.read_some(boost::asio::buffer(pData, maxSize), error_);\nExample: I want to read some from ...
I have a view that I would like the user to rotate around its center, by tapping and holding somewhere and just move their finger round and round. I have all the geometry worked out; What I do is store the initial touch angle relative to the center as offsetAngle, then my touchesMoved method looks like this: - (void) t...
Your current approach to rotating a view around its center and handling its frame manipulation is leading to some challenges, particularly due to the complexity introduced by transformations. Here are a few suggestions and considerations to help improve your implementation and address the issues you've mentioned: ### ...
42,570
[ { "from": "human", "value": "I have a view that I would like the user to rotate around its center, by tapping and holding somewhere and just move their finger round and round.\nI have all the geometry worked out; What I do is store the initial touch angle relative to the center as offsetAngle, then my touch...
I am writing a .NET library that for various reasons cannot be registered in the GAC. This dll (let's call it SDK.dll) depends on other DLLs in order to be loaded. When writing a program that uses this SDK.dll, I noticed that my program failed loading the dll with a FileNotFoundException thrown. This happens because al...
In .NET, when a DLL (like your `SDK.dll`) is loaded, the Common Language Runtime (CLR) resolves its dependencies based on a series of default locations, including the application's directory, the Global Assembly Cache (GAC), and other specified probing paths. If you cannot place all dependencies in the same directory a...
43,666
[ { "from": "human", "value": "I am writing a .NET library that for various reasons cannot be registered in the GAC.\nThis dll (let's call it SDK.dll) depends on other DLLs in order to be loaded.\nWhen writing a program that uses this SDK.dll, I noticed that my program failed loading the dll with a FileNotFou...
I'm creating an ActiveX control that will be used in web pages to query the current installed version of a 3rd party software on the client machine. The control only needs to expose a single method - GetVersion - that returns the version as an integer. I'm very inexperienced with ActiveX, and I'm having problems with s...
When you change your ActiveX method from returning `void` to returning an `int`, there are a few key areas where things could go wrong, especially if you're experiencing a crash. Let's go over a few things you should check and update to ensure your implementation works correctly. ### 1. Change the MessageBox Handling ...
41,825
[ { "from": "human", "value": "I'm creating an ActiveX control that will be used in web pages to query the current installed version of a 3rd party software on the client machine. The control only needs to expose a single method - GetVersion - that returns the version as an integer. I'm very inexperienced wit...
I'm using MVC to validate some html text boxes on a page, for example in my controller there is if (String.IsNullOrEmpty(name)) { ModelState.AddModelError("name", "You must specify a name."); } if (ViewData.ModelState.IsValid) { return RedirectToAction("...
In ASP.NET MVC, when you want to return a view with model errors while also populating additional data like `SelectList`, the common pattern is to ensure that you encapsulate the repeated logic into a helper method or utilize a ViewModel that contains the necessary data alongside any validation messages. Instead of re...
38,528
[ { "from": "human", "value": "I'm using MVC to validate some html text boxes on a page, for example in my controller there is\n if (String.IsNullOrEmpty(name))\n {\n ModelState.AddModelError(\"name\", \"You must specify a name.\");\n }\n\n\n if (ViewData.ModelState.IsVa...
Anyone have suggestions for security auditing of an .NET Web Application? I'm interested in all options. I'd like to be able to have something agnostically probe my application for security risks. EDIT: To clarify, the system has been designed with security in mind. The environment has been setup with security in min...
Performing a security audit on a .NET web application can indeed be a challenging task, especially when trying to find a balance between thoroughness and cost. Here are several strategies and tools you might consider for an automated security audit, alongside some manual techniques: ### Automated Security Scanning Too...
43,438
[ { "from": "human", "value": "Anyone have suggestions for security auditing of an .NET Web Application?\nI'm interested in all options. I'd like to be able to have something agnostically probe my application for security risks.\nEDIT:\nTo clarify, the system has been designed with security in mind. The env...
Background This question is in two parts. I have a one-way WCF operation hosted in IIS 6. The following is my understanding of how this works: _1. IIS receives a request. _2. IIS sends an HTTP 202 response (thanks, I'll process this later). _3. IIS calls my one-way WCF operation. Now control passes to my WCF operatio...
Your understanding of how a one-way WCF operation hosted in IIS 6 operates is largely correct, but let's clarify a few points regarding your questions. ### Question 1: Is my understanding of when IIS sends the HTTP 202 response correct? Yes, your understanding is correct. When you have a one-way WCF operation, the fo...
40,590
[ { "from": "human", "value": "Background\nThis question is in two parts.\nI have a one-way WCF operation hosted in IIS 6. The following is my understanding of how this works:\n\n_1. IIS receives a request.\n_2. IIS sends an HTTP 202 response (thanks, I'll process this later).\n_3. IIS calls my one-way WCF op...
I am trying to passing in 3 pointers to a DLL function. I have: { $code=1; $len=100; $str=" " x $len; $function = new Win32::API(DLLNAME,'dllfunction','PPP','V'); $function->Call($code,$str,$len); } The DLL is defined as void dllfunction(int* a, char* str, int* len); The DLL will modify all the variables pointed ...
It looks like you're trying to pass pointers from Perl to a DLL function and are running into issues with memory management and the expected data types. Let's break down the issues and propose a solution: 1. **Data Types and Passing Addresses**: In your DLL function definition, you have `void dllfunction(int* a, char*...
42,890
[ { "from": "human", "value": "I am trying to passing in 3 pointers to a DLL function. I have:\n\n{\n\n$code=1;\n$len=100;\n$str=\" \" x $len;\n\n$function = new Win32::API(DLLNAME,'dllfunction','PPP','V');\n\n$function->Call($code,$str,$len);\n\n}\n\nThe DLL is defined as void dllfunction(int* a, char* str, ...
I have a command-line process I would like to automate and capture in C#. At the command line, I type: nslookup This launches a shell which gives me a > prompt. At the prompt, I then type: ls -a mydomain.local This returns a list of local CNAMEs from my primary DNS server and the physical machines they are attached t...
To automate the process of sending commands to a command-line tool like `nslookup`, you can use the `Process` class in C#. However, `nslookup` is a little special because it requires interactive input after it starts. To handle this, you'll need to create a `Process` that can interact with the standard input and outpu...
42,404
[ { "from": "human", "value": "I have a command-line process I would like to automate and capture in C#.\nAt the command line, I type:\nnslookup\n\nThis launches a shell which gives me a > prompt. At the prompt, I then type:\nls -a mydomain.local\n\nThis returns a list of local CNAMEs from my primary DNS serv...
Do you think ASP.NET MVC is able to develop RESTful web services and which approach you would use for it?
Yes, ASP.NET MVC is capable of developing RESTful web services, although it's more common to use ASP.NET Web API or ASP.NET Core for this purpose, as they are specifically designed with RESTful services in mind. However, if you want to use ASP.NET MVC for creating RESTful services, you can certainly do so. ### Approac...
40,273
[ { "from": "human", "value": "Do you think ASP.NET MVC is able to develop RESTful web services and which approach you would use for it?\n" }, { "from": "gpt", "value": "Yes, ASP.NET MVC is capable of developing RESTful web services, although it's more common to use ASP.NET Web API or ASP.NET Core...
Using python 2.4 and the built-in ZipFile library, I cannot read very large zip files (greater than 1 or 2 GB) because it wants to store the entire contents of the uncompressed file in memory. Is there another way to do this (either with a third-party library or some other hack), or must I "shell out" and unzip it tha...
In Python 2.4, the built-in `ZipFile` library indeed has limitations when handling very large zip files, particularly when it comes to memory usage. If you are dealing with large zip files (greater than 1-2 GB) and the built-in `ZipFile` module is not able to handle them efficiently due to memory constraints, here are ...
40,299
[ { "from": "human", "value": "Using python 2.4 and the built-in ZipFile library, I cannot read very large zip files (greater than 1 or 2 GB) because it wants to store the entire contents of the uncompressed file in memory. Is there another way to do this (either with a third-party library or some other hack...
Windows 6 (Vista and Server 2008) support proper symbolic links, which can be created via the CreateSymbolicLink function. But there doesn't appear to be a corresponding function for interrogating a symbolic link to obtain the path of the link's target. I have found out that symbolic links are an implementation of repa...
To obtain the target path of a symbolic link, especially when dealing with remote (UNC) paths, the common functions can be tricky due to the limitations you've encountered. Here's a summary of the approaches you can take, and some additional methods you might try: 1. **Use the `DeviceIoControl` with `FSCTL_GET_REPARSE...
43,251
[ { "from": "human", "value": "Windows 6 (Vista and Server 2008) support proper symbolic links, which can be created via the CreateSymbolicLink function. But there doesn't appear to be a corresponding function for interrogating a symbolic link to obtain the path of the link's target.\nI have found out that sy...
I'm completely new to this MSBuild tool (and still somewhat lost) but nonetheless I have a question someone might be able to answer: I am trying to auto-generate version info into AssemblyVersion.cs files by the contents of a file. To set the verion info I found the AssemblyInfoTask which works quite well - but how do ...
Hi Florian, Welcome to the world of MSBuild! It can be a bit overwhelming at first, but once you get the hang of it, you'll find it to be a powerful tool for managing your builds. To auto-generate version information in your `AssemblyVersion.cs` files based on the contents of a specific file, you can use the `Assembl...
42,630
[ { "from": "human", "value": "I'm completely new to this MSBuild tool (and still somewhat lost) but nonetheless I have a question someone might be able to answer:\nI am trying to auto-generate version info into AssemblyVersion.cs files by the contents of a file.\nTo set the verion info I found the AssemblyIn...
I saw this the other day (scroll all the way down to see some of the clever stuff): http://www.mono-project.com/docs/tools+libraries/tools/repl/ And wondered whether something like this exists for Python. So, is there a good Python GUI shell that can do stuff like that C# shell can do? Edit: Here are links to screen...
Yes, there are several options for creating GUI-based interactive Python environments similar to what you described for C#. Here are a few: ### 1. **Jupyter Notebook** Jupyter Notebook is a web-based interactive computing environment that allows you to create and share documents containing live code, equations, visual...
44,030
[ { "from": "human", "value": "I saw this the other day (scroll all the way down to see some of the clever stuff): \n\nhttp://www.mono-project.com/docs/tools+libraries/tools/repl/\n\nAnd wondered whether something like this exists for Python.\nSo, is there a good Python GUI shell that can do stuff like that C...
I am new to SQL Server, and I have been tasked with setting permissions on a remote server. What I need to do is limit the domain admin from having access to any of the DB's on a particular server. How can I accomplish this?
In SQL Server, managing permissions, especially with domain users, can sometimes be a bit tricky, particularly when dealing with domain admins who inherently have elevated privileges. Here’s a step-by-step approach on how to limit access for a domain admin on a specific SQL Server instance: ### Step 1: Remove Domain A...
42,418
[ { "from": "human", "value": "I am new to SQL Server, and I have been tasked with setting permissions on a remote server. What I need to do is limit the domain admin from having access to any of the DB's on a particular server. How can I accomplish this?\n" }, { "from": "gpt", "value": "In SQL ...
I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent. The previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or not. The two ways are: var functionOne = ...
In JavaScript, there are indeed multiple ways to define functions, and each method has its own implications in terms of scope, hoisting, and usage. Let's break down the two methods you've mentioned: ### 1. Function Expressions ```javascript var functionOne = function() { // Some code }; ``` #### Characteristics:...
42,346
[ { "from": "human", "value": "I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent.\nThe previous developer used two ways of declaring functions and I can't work out if there is a reason behind it or...
Can we write an regular expression such that it splits the stored procedure in multiple SQL statements. It should split update, delete select etc statements. Edit: my attempt to solve the problem http://tsqlparsergdr.codeplex.com/
Yes, you can create a regular expression to split a SQL stored procedure into separate statements such as `UPDATE`, `DELETE`, `SELECT`, `INSERT`, etc. However, crafting such a regex can be challenging due to the complexity of SQL syntax and possible variations in formatting. Here is a general approach to construct a r...
41,018
[ { "from": "human", "value": "Can we write an regular expression such that it splits the stored procedure in multiple SQL statements. \nIt should split update, delete select etc statements.\nEdit: my attempt to solve the problem http://tsqlparsergdr.codeplex.com/\n" }, { "from": "gpt", "value": "...
I have an ASP.NET MVC project with a form. In the Action method that handles the POST verb I have a custom IModelBinder implementation that is binding the form data to my model instance. If there are errors I am using bindingContext.ModelState.SetAttemptedValue() and bindingContext.ModelState.AddModelError() to persis...
In ASP.NET MVC, when you are using `Html.CheckBox()`, it does not automatically handle the `AttemptedValue` from the `ModelState` in the same way that `Html.TextBox()` does. This behavior is expected because checkboxes have a distinct way of handling their values. ### Explanation A checkbox in HTML will have a value ...
41,272
[ { "from": "human", "value": "I have an ASP.NET MVC project with a form. In the Action method that handles the POST verb I have a custom IModelBinder implementation that is binding the form data to my model instance. If there are errors I am using bindingContext.ModelState.SetAttemptedValue() and bindingCon...
How do you do the following operations in C++? Opening Files Closing Files Reading Files Writing Files
In C++, file operations are handled using the standard library's `<fstream>` header, which provides facilities for reading from and writing to files. Here’s how you can perform each of the operations you mentioned: opening files, closing files, reading files, and writing files. ### 1. Opening Files To open a file, you...
35,021
[ { "from": "human", "value": "How do you do the following operations in C++?\n\nOpening Files\nClosing Files\nReading Files\nWriting Files\n\n" }, { "from": "gpt", "value": "In C++, file operations are handled using the standard library's `<fstream>` header, which provides facilities for reading ...
I'd like them to be easy to bundle, with few dependencies and easy to use.
It sounds like you're looking for tools or libraries that are lightweight, have minimal dependencies, and are user-friendly for bundling into a project. Here are some suggestions across different categories: ### JavaScript Libraries 1. **Lodash**: A utility library that provides functions for common programming tasks....
43,896
[ { "from": "human", "value": "I'd like them to be easy to bundle, with few dependencies and easy to use.\n" }, { "from": "gpt", "value": "It sounds like you're looking for tools or libraries that are lightweight, have minimal dependencies, and are user-friendly for bundling into a project. Here a...
Is there a good cross-browser way to set a max-height property of a DIV and when that DIV goes beyond the max-height, it turns into an overflow with scrollbars?
Yes, you can achieve this with CSS, and it is a cross-browser solution. To set a maximum height on a `<div>` and ensure that it displays scrollbars when the content exceeds that height, you can use the `max-height` and `overflow` properties. Here’s a simple example: ```html <!DOCTYPE html> <html lang="en"> <head> ...
43,292
[ { "from": "human", "value": "Is there a good cross-browser way to set a max-height property of a DIV and when that DIV goes beyond the max-height, it turns into an overflow with scrollbars?\n" }, { "from": "gpt", "value": "Yes, you can achieve this with CSS, and it is a cross-browser solution. T...
How would I expose an Objective-C method within JavaScript when using the iPhone SDK when using the UIWebView? Any help would be appreciated!
To expose an Objective-C method to JavaScript in a `UIWebView`, you can use the `stringByEvaluatingJavaScriptFromString:` method to execute JavaScript from your Objective-C code. You can also use the `UIWebView`'s delegate method `webView:shouldStartLoadWithRequest:navigationType:` to intercept specific URL patterns th...
42,252
[ { "from": "human", "value": "How would I expose an Objective-C method within JavaScript when using the iPhone SDK when using the UIWebView?\nAny help would be appreciated!\n" }, { "from": "gpt", "value": "To expose an Objective-C method to JavaScript in a `UIWebView`, you can use the `stringByEv...
I am currently storing many different types of objects in the ASP.NET HttpRuntime.Cache and I was wondering if there is a way to figure out how big each object is?
In ASP.NET, the `HttpRuntime.Cache` allows you to store various types of objects, but there isn't a built-in way to directly determine the size of objects stored in the cache. However, you can estimate the size of these objects using a few different approaches: ### 1. Use Serialization One common approach is to serial...
41,288
[ { "from": "human", "value": "I am currently storing many different types of objects in the ASP.NET HttpRuntime.Cache and I was wondering if there is a way to figure out how big each object is?\n" }, { "from": "gpt", "value": "In ASP.NET, the `HttpRuntime.Cache` allows you to store various types ...
I need to copy an entire database from a SQL Server 2005 on my server over to my local SQL Express in order to run my application for a presentation. What is the fastest/easiest way to get this done? EDIT: I have very limited access to my server so I don't think I can access the backup file that I could create so tha...
If you have limited access to your SQL Server 2005 instance and cannot create a backup file, you might consider using SQL Server Management Studio (SSMS) to generate a script that will create the database and all its objects (tables, stored procedures, etc.) on your local SQL Express instance. Here’s how you can do thi...
42,741
[ { "from": "human", "value": "I need to copy an entire database from a SQL Server 2005 on my server over to my local SQL Express in order to run my application for a presentation. What is the fastest/easiest way to get this done?\nEDIT: I have very limited access to my server so I don't think I can access ...
Using Managed C++ (VS 2005), how would you pass a array< unsigned char > to a function as a unsigned char*? ref class Utils { public: static void A(array<unsigned char, 1> a) { //How do I call B()???? } static void B(const unsigned char* a) { //do stuff } };
In Managed C++, when you want to pass an `array<unsigned char>^` to a function that expects a `const unsigned char*`, you need to use the `PinPtr` to obtain a pointer to the managed array. Below is how you can achieve this in your `Utils` class. Here's how you can modify your `Utils` class to pass the `array<unsigned ...
42,535
[ { "from": "human", "value": "Using Managed C++ (VS 2005), how would you pass a array< unsigned char > to a function as a unsigned char*?\n ref class Utils\n {\n public: \n\n static void A(array<unsigned char, 1> a)\n {\n //How do I call B()????\n }\n\n static void B(const unsigned ...
I've built a entity framework model against a 2008 database. All works ok against the 2008 database. When I try to update the entity on a 2005 database I get this error. The version of SQL Server in use does not support datatype 'datetime2 I specifically did not use any 2008 features when I built the database. I c...
The error message you are encountering, "The version of SQL Server in use does not support datatype 'datetime2'," indicates that your Entity Framework model is somehow trying to use the `datetime2` type, which is not supported in SQL Server 2005. Here are some steps you can take to troubleshoot and resolve this issue...
43,822
[ { "from": "human", "value": "I've built a entity framework model against a 2008 database. All works ok against the 2008 database. When I try to update the entity on a 2005 database I get this error. \nThe version of SQL Server in use does not support datatype 'datetime2\nI specifically did not use any 20...
Here's the code: render :file => @somedir + "/blah.xml" ...but the resulting MIME type is text/html when I check in FireBug. How do I specify a MIME type in this case?
To specify the MIME type when rendering a file in a Rails controller, you can use the `content_type` option in the `render` method. Here's how you can modify your code to ensure that the correct MIME type is set for the XML file: ```ruby render :file => @somedir + "/blah.xml", :content_type => 'application/xml' ``` T...
47,170
[ { "from": "human", "value": "Here's the code:\nrender :file => @somedir + \"/blah.xml\"\n\n...but the resulting MIME type is text/html when I check in FireBug. How do I specify a MIME type in this case?\n" }, { "from": "gpt", "value": "To specify the MIME type when rendering a file in a Rails co...
I once found a paper on path finding through a simulation that involved smoke(fluids in general). Has anyone read anything like this ? I can't remember the name of the paper or the author. If you know a paper like this please tell me
It sounds like you might be referring to research in the area of fluid simulation for pathfinding, which is often used in computer graphics and robotics. One prominent paper in this domain is "Fluid Simulation for Computer Graphics" by Robert Bridson, which provides a comprehensive overview of fluid simulation techniqu...
44,682
[ { "from": "human", "value": "I once found a paper on path finding through a simulation that involved smoke(fluids in general).\nHas anyone read anything like this ? \nI can't remember the name of the paper or the author.\nIf you know a paper like this please tell me\n" }, { "from": "gpt", "value...
How, under Windows and Linux, given a thread handle can I determine the beginning and end of its corresponding static thread local storage block?
Determining the beginning and end of a thread's static thread-local storage (TLS) block is platform-dependent and can be complex due to the way operating systems manage memory and TLS. Below, I’ll summarize approaches for both Windows and Linux. ### Windows In Windows, thread-local storage can be managed via the `Tls...
41,818
[ { "from": "human", "value": "How, under Windows and Linux, given a thread handle can I determine the beginning and end of its corresponding static thread local storage block?\n" }, { "from": "gpt", "value": "Determining the beginning and end of a thread's static thread-local storage (TLS) block ...
I need a way to check for Wi-Fi routers/access points on my DS homebrew. I'm using PAlib.
To check for Wi-Fi routers or access points on your DS homebrew project using PAlib, you'll need to utilize the DS's built-in Wi-Fi capabilities. PAlib simplifies some of the programming aspects, but you'll still need to handle the networking yourself to some extent. Here's a simple guide to scan for Wi-Fi networks: ...
43,147
[ { "from": "human", "value": "I need a way to check for Wi-Fi routers/access points on my DS homebrew. I'm using PAlib.\n" }, { "from": "gpt", "value": "To check for Wi-Fi routers or access points on your DS homebrew project using PAlib, you'll need to utilize the DS's built-in Wi-Fi capabilities...
I'm using StructureMap in my project and when the application finishes running I need to call the Dispose() method on all of the Singleton instances inside the ObjectFactory that implement IDisposable. I cannot find anyway to do it via the StructureMap API. Another thought I had was to get a reference to every instance...
To properly dispose of your singleton instances that implement `IDisposable` in StructureMap, you can use the `IContainer` interface to manage your object lifecycle. StructureMap provides a `Container` class that can help you manage your instances. Here’s a way you can dispose of your singletons: 1. **Get all single...
43,205
[ { "from": "human", "value": "I'm using StructureMap in my project and when the application finishes running I need to call the Dispose() method on all of the Singleton instances inside the ObjectFactory that implement IDisposable.\nI cannot find anyway to do it via the StructureMap API.\nAnother thought I h...
I had been steering away from C# for a while, because it was "just a Windows thing", and it fell out of my current needs. However It's been gaining popularity and now with Mono catching up, it's becoming more attractive but I was wondering what IDE are people using to Code C#(with Mono) on *nix platforms.
When it comes to developing C# applications on Unix-like platforms using Mono, several IDEs and code editors have gained popularity. Here are some of the most commonly used options: 1. **Visual Studio Code**: This is a lightweight and highly extensible code editor that supports C# development through the C# extension ...
43,398
[ { "from": "human", "value": "I had been steering away from C# for a while, because it was \"just a Windows thing\", and it fell out of my current needs. However It's been gaining popularity and now with Mono catching up, it's becoming more attractive but I was wondering what IDE are people using to Code C#(...
How would I accomplish displaying a line as the one below in a console window by writing it into a variable during design time then just calling Console.WriteLine(sDescription) to display it? Options: -t Description of -t argument. -b Description of -b argument.
To accomplish the desired output in a console window, you can create a string variable during design time that contains the formatted text with the necessary line breaks and indentation. You can use the `@` symbol in C# to create a verbatim string literal, which makes it easier to include line breaks and whitespace wit...
45,012
[ { "from": "human", "value": "How would I accomplish displaying a line as the one below in a console window by writing it into a variable during design time then just calling Console.WriteLine(sDescription) to display it?\n Options:\n -t Description of -t argument.\n -b ...
if i have : <div class="carBig"></div> and <div class="car"></div> and $(".car").size(); i get 2 items ..
The reason you're getting a size of 2 with the jQuery statement `$(".car").size();` is due to the fact that `$(".car")` is selecting all elements with the class name `car`. In your example, you have: 1. `<div class="carBig"></div>` - This does not match the selector. 2. `<div class="car"></div>` - This matches the sel...
45,278
[ { "from": "human", "value": "if i have :\n<div class=\"carBig\"></div>\n\nand\n<div class=\"car\"></div>\n\nand $(\".car\").size();\ni get 2 items ..\n" }, { "from": "gpt", "value": "The reason you're getting a size of 2 with the jQuery statement `$(\".car\").size();` is due to the fact that `$(...
I wanted to see if folks were using decimal for financial applications instead of double. I have seen lots of folks using double all over the place with unintended consequences . . Do you see others making this mistake . . .
Yes, the use of `double` for financial applications is a common mistake and can lead to unintended consequences. The primary issue with using floating-point types like `double` for financial calculations is that they represent numbers in a way that can introduce rounding errors due to how binary floating-point arithmet...
43,486
[ { "from": "human", "value": "I wanted to see if folks were using decimal for financial applications instead of double. I have seen lots of folks using double all over the place with unintended consequences . .\nDo you see others making this mistake . . .\n" }, { "from": "gpt", "value": "Yes, th...
I manage a small group of Windows Server 2003 computers. ONE of the the servers is NOT performing the same as the others. I expect that I have not set the folder and share permissions the same as the others. I want to be able to create a text document containing the share and folder permissions from each server so...
To create a text document containing folder and share permissions on your Windows Server 2003 machines, you can use a combination of built-in commands and PowerShell scripts. However, since Windows Server 2003 doesn't have native PowerShell support, you will mainly rely on command-line tools. ### Step 1: Gather Share...
43,165
[ { "from": "human", "value": "I manage a small group of Windows Server 2003 computers. ONE of the the servers is NOT performing the same as the others. \nI expect that I have not set the folder and share permissions the same as the others. \nI want to be able to create a text document containing the share...
how do you encode words using the huffman code such as NEED
To encode the word "NEED" using Huffman coding, you first need to follow these general steps: 1. **Calculate the Frequency of Each Character**: Count how many times each character appears in the word. For the word "NEED": - N: 1 - E: 2 - D: 1 So, the frequencies are: - N: 1 - E: 2 - D: 1 ...
43,892
[ { "from": "human", "value": "how do you encode words using the huffman code such as NEED\n" }, { "from": "gpt", "value": "To encode the word \"NEED\" using Huffman coding, you first need to follow these general steps:\n\n1. **Calculate the Frequency of Each Character**: Count how many times each...
What is the simplest way to get the NT-ID of a user in a C# application? I would probably need to get it only having a name of the user, or maybe an email address.
To retrieve the NT ID (NT username) of a user in a C# application, you can use the `System.DirectoryServices` namespace, which provides easy access to Active Directory services. You can look up users by their email address or username. Here is a simple example of how to get the NT-ID of a user using their email addres...
42,915
[ { "from": "human", "value": "What is the simplest way to get the NT-ID of a user in a C# application? I would probably need to get it only having a name of the user, or maybe an email address.\n" }, { "from": "gpt", "value": "To retrieve the NT ID (NT username) of a user in a C# application, you...
Seeing as C# can't switch on a Type (which I gather wasn't added as a special case because is relationships mean that more than one distinct case might apply), is there a better way to simulate switching on type other than this? void Foo(object o) { if (o is A) { ((A)o).Hop(); } else if (o is B)...
In C#, you can achieve a type-based behavior akin to a switch statement through pattern matching and using `switch` expressions. This approach can make your code cleaner and more maintainable than using multiple `if-else` statements. Here's how you can implement it using a switch expression along with type pattern matc...
42,813
[ { "from": "human", "value": "Seeing as C# can't switch on a Type (which I gather wasn't added as a special case because is relationships mean that more than one distinct case might apply), is there a better way to simulate switching on type other than this?\nvoid Foo(object o)\n{\n if (o is A)\n {\n ...
In an HTML table, the cellpadding and cellspacing can be set like this: <table cellspacing="1" cellpadding="1"> How can the same be accomplished using CSS?
To achieve the same effect as the `cellspacing` and `cellpadding` attributes in HTML using CSS, you can use the `border-spacing` property for `cellspacing` and the `padding` property for `cellpadding`. Here's how you can do it: 1. **Cellspacing**: This controls the space between the cells. You can use the `border-spa...
43,596
[ { "from": "human", "value": "In an HTML table, the cellpadding and cellspacing can be set like this:\n<table cellspacing=\"1\" cellpadding=\"1\">\n\nHow can the same be accomplished using CSS?\n" }, { "from": "gpt", "value": "To achieve the same effect as the `cellspacing` and `cellpadding` attr...
How do I create a batch file timer to execute / call another batch through out the day Maybe on given times to run but not to run on weekends ? Must run on system times can also be .cmd to run on xp server 2003
Creating a batch file timer to execute another batch file at specified times throughout the day, while skipping weekends, involves writing a batch script that checks the current day and time. Below is an example of how to achieve this on a Windows XP Server 2003 environment. ### Step 1: Create the Main Batch File You...
41,452
[ { "from": "human", "value": "How do I create a batch file timer to execute / call another batch through out the day Maybe on given times to run but not to run on weekends ? Must run on system times can also be .cmd to run on xp server 2003 \n" }, { "from": "gpt", "value": "Creating a batch fi...
I'm wondering why the assert keyword is so underused in Java? I've almost never seen them used, but I think they're a great idea. I certainly much prefer the brevity of: assert param != null : "Param cannot be null"; to the verbosity of: if (param == null) { throw new IllegalArgumentException("Param cannot be null...
You raise some interesting points about the underutilization of the `assert` keyword in Java. Here are some reasons why assertions may not be as commonly used: 1. **Established Coding Practices**: As you mentioned, assertions were introduced in Java 1.4, which was well into the language's lifecycle. Many developers ha...
42,536
[ { "from": "human", "value": "I'm wondering why the assert keyword is so underused in Java? I've almost never seen them used, but I think they're a great idea. I certainly much prefer the brevity of:\nassert param != null : \"Param cannot be null\";\n\nto the verbosity of:\nif (param == null) {\n throw ne...
What is the best tool for Java for aspect-oriented programming? The requirements for a tool are of course IDE support, expressiveness and proper documentation.
For aspect-oriented programming (AOP) in Java, one of the best tools available is **AspectJ**. Here’s a breakdown of why AspectJ fits your requirements: ### 1. **IDE Support** - **Eclipse**: AspectJ has strong integration with the Eclipse IDE through the AspectJ Development Tools (AJDT). This allows for seamless devel...
43,968
[ { "from": "human", "value": "What is the best tool for Java for aspect-oriented programming? \nThe requirements for a tool are of course IDE support, expressiveness and proper documentation.\n" }, { "from": "gpt", "value": "For aspect-oriented programming (AOP) in Java, one of the best tools ava...
Code like this often happens: l = [] while foo: # baz l.append(bar) # qux This is really slow if you're about to append thousands of elements to your list, as the list will have to be constantly resized to fit the new elements. In Java, you can create an ArrayList with an initial capacity. If you have some...
Yes, Python's list does not allow you to set an initial capacity like Java's `ArrayList`. However, you can optimize list appending in Python by pre-allocating a list with a specified size. This approach can improve performance when you have an idea of how many elements you'll be adding, especially in cases where the lo...
44,510
[ { "from": "human", "value": "Code like this often happens:\nl = []\nwhile foo:\n # baz\n l.append(bar)\n # qux\n\nThis is really slow if you're about to append thousands of elements to your list, as the list will have to be constantly resized to fit the new elements.\nIn Java, you can create an Arr...
A lot of files will be stored in the DB and I need file hashes to unique identify that the file was not changed. (In general, will be used as the Windows Personal Firewall part)
To uniquely identify files and ensure that they have not changed, using cryptographic hash functions is a good approach. A hash function takes an input (in this case, a file) and produces a fixed-size string of bytes that is unique to that input. If the file changes, even slightly, the hash will change significantly. H...
40,967
[ { "from": "human", "value": "A lot of files will be stored in the DB and I need file hashes to unique identify that the file was not changed.\n(In general, will be used as the Windows Personal Firewall part)\n" }, { "from": "gpt", "value": "To uniquely identify files and ensure that they have no...
What is the best way to find the total number of words in a text file in Java? I'm thinking Perl is the best on finding things such as this. If this is true then calling a Perl function from within Java would be the best? What would you have done in condition such as this? Any better ideas?
While Perl is indeed a powerful language for text processing, you don't necessarily need to call Perl from Java to count the number of words in a text file. Java has robust file handling and string manipulation capabilities that can accomplish this task efficiently without requiring an external dependency. Here's a s...
43,712
[ { "from": "human", "value": "What is the best way to find the total number of words in a text file in Java? I'm thinking Perl is the best on finding things such as this. If this is true then calling a Perl function from within Java would be the best? What would you have done in condition such as this? Any b...
I have a ClickOnce environment like this: \\Fileserver\ClickOnceApps\App1.application C:\Documents and Settings\user\Start Menu\Programs\publisher\app1.appref-ms My understanding is the .apppref-ms file is a glorified link to the app.application file. Does it do anything else?
Yes, you're correct that the `.appref-ms` file is essentially a shortcut or link to a ClickOnce application, which is defined by the `.application` file (in your case, `App1.application`). The `.appref-ms` file is a special type of shortcut created by the ClickOnce deployment system to launch the application. Here are...
36,946
[ { "from": "human", "value": "I have a ClickOnce environment like this:\n\\\\Fileserver\\ClickOnceApps\\App1.application\nC:\\Documents and Settings\\user\\Start Menu\\Programs\\publisher\\app1.appref-ms\nMy understanding is the .apppref-ms file is a glorified link to the app.application file. Does it do any...
I would try something like this but it isn't allowed. function GetDynamicModulesProperties() { var selectedValue = $("#moduletype option:selected").val(); if (selectedValue.lenght() > 0) { var url = '<%= Url.Action("GetModuleProperties", new { sectionid = ViewData.Model.Id, moduleTypeId = selectedValue...
It looks like you are trying to create a JavaScript function that fetches dynamic module properties based on the selected value from a dropdown list. However, it seems there is a typo in your code and a few improvements that can be made. ### Issues Identified: 1. **Typo**: `lenght()` should be `length`. 2. **jQuery Us...
42,286
[ { "from": "human", "value": "I would try something like this but it isn't allowed.\nfunction GetDynamicModulesProperties() {\n var selectedValue = $(\"#moduletype option:selected\").val();\n if (selectedValue.lenght() > 0) {\n\n var url = '<%= Url.Action(\"GetModuleProperties\", new { sectionid...
I can use set_error_handler() to catch most PHP errors, but it doesn't work for fatal (E_ERROR) errors, such as calling a function that doesn't exist. Is there another way to catch these errors? I am trying to call mail() for all errors and am running PHP 5.2.3.
In PHP 5.2.3, you're right that `set_error_handler()` allows you to handle most types of errors, but it won't catch fatal errors (like calling a non-existent function). To catch fatal errors, you can use the `register_shutdown_function()` function to set a shutdown handler. This allows you to execute custom code when t...
44,559
[ { "from": "human", "value": "I can use set_error_handler() to catch most PHP errors, but it doesn't work for fatal (E_ERROR) errors, such as calling a function that doesn't exist. Is there another way to catch these errors?\nI am trying to call mail() for all errors and am running PHP 5.2.3.\n" }, { ...
I know that in Unix (specifically, Mac OS X) the superblock stores information about the layout of data on the disk, including the disk addresses at which the inodes begin and end. I want to scan the list of inodes in my program to look for deleted files. How can I find the disk address at which the inodes begin? I ...
To find the disk address at which inodes begin, you'll need to analyze the filesystem directly, as utilities like `statfs` generally abstract away low-level details. Here's a general approach to help you achieve this. ### Steps to Find the Inode Table Location 1. **Identify the Filesystem Type**: The method of loc...
41,066
[ { "from": "human", "value": "I know that in Unix (specifically, Mac OS X) the superblock stores information about the layout of data on the disk, including the disk addresses at which the inodes begin and end. I want to scan the list of inodes in my program to look for deleted files. How can I find the di...
Here is what I'm doing : Create a workbook in memory (book = new HSSFWorkbook(), ...) Save it to disk (book.write(...)) Open in Excel (ok) Create another workbook in Excel, which links to the first one (=PoiWorkbook?xls!A1) Close Excel Then everytime I open the second workbook again, all the links are #N/A, unless I ...
The behavior you're experiencing is likely due to how Excel handles external links to workbooks that are created programmatically (like with Apache POI) versus those that are created manually. When you create a workbook using Apache POI and then link to it in Excel, Excel may not retain the link properly unless both wo...
43,784
[ { "from": "human", "value": "Here is what I'm doing :\n\nCreate a workbook in memory (book = new HSSFWorkbook(), ...)\nSave it to disk (book.write(...))\nOpen in Excel (ok)\nCreate another workbook in Excel, which links to the first one (=PoiWorkbook?xls!A1)\nClose Excel\n\nThen everytime I open the second ...
I want to convert gdi+ Bitmap into gdi object HBitmap. I am using the following method: Bitmap* img = new Bitmap(XXX); // lots of codes... HBITMAP temp; Color color; img->GetHBITMAP(color, &temp); the img object is drawing on a dialog. when this part of method is called, strange thing happen...
When you convert a GDI+ `Bitmap` object to a GDI `HBITMAP` using the `GetHBITMAP` method, there are a few things happening that may affect how your image appears in the window. ### Potential Reasons for Appearance Change: 1. **Dithering or Resampling**: The `GetHBITMAP` method can apply resampling or dithering when c...
43,677
[ { "from": "human", "value": "I want to convert gdi+ Bitmap into gdi object HBitmap.\nI am using the following method:\n Bitmap* img = new Bitmap(XXX);\n // lots of codes...\n HBITMAP temp;\n Color color;\n img->GetHBITMAP(color, &temp);\n\nthe img object is drawing on a dialog.\nwhen t...
I have a UINavigationController containing an UIViewController initialized with a UIView. The UINavigationController also has a UINavigationBar as usual. Previously when I positioned a new element in the UIView at 0,0 using CGRectMake(0,0,height,width); It would position it directly beneath the UINavigationController....
This behavior you're encountering is related to the changes made in the way iOS handles the layout of views, particularly concerning the `UINavigationBar` in version 2.2 of the SDK. In iOS 2.2, the introduction of the view controller's automatically managed view frames caused the view to respect the navigation bar's he...
44,462
[ { "from": "human", "value": "I have a UINavigationController containing an UIViewController initialized with a UIView.\nThe UINavigationController also has a UINavigationBar as usual.\nPreviously when I positioned a new element in the UIView at 0,0 using\nCGRectMake(0,0,height,width);\n\nIt would position i...
I'd like to check a few queries generated by ActiveRecord, but I don't need to actually run them. Is there a way to get at the query before it returns its result?
Yes, in ActiveRecord, you can capture the SQL queries that are generated without executing them. This can be particularly useful for debugging or understanding how ActiveRecord constructs its queries. Here are a few ways to achieve that: ### 1. Using `to_sql` ActiveRecord provides the `to_sql` method, which can be ca...
43,048
[ { "from": "human", "value": "I'd like to check a few queries generated by ActiveRecord, but I don't need to actually run them. Is there a way to get at the query before it returns its result?\n" }, { "from": "gpt", "value": "Yes, in ActiveRecord, you can capture the SQL queries that are generat...
I often need to make a manifest of files with Microsoft Visual Source Safe version numbers on them. Is there a way to get a list of files with version numbers in a project?
Yes, you can retrieve a list of files with their version numbers in Microsoft Visual SourceSafe (VSS) using several methods. Here are two common approaches: using the Visual SourceSafe Explorer and using the command line. ### Method 1: Using Visual SourceSafe Explorer 1. Open Visual SourceSafe Explorer. 2. Navigate t...
43,427
[ { "from": "human", "value": "I often need to make a manifest of files with Microsoft Visual Source Safe version numbers on them. Is there a way to get a list of files with version numbers in a project?\n" }, { "from": "gpt", "value": "Yes, you can retrieve a list of files with their version num...
Does anyone know how to convert long to short pathnames in .net 3.5 without p/invoke? I can do it with p/invoke if I have to, but I'd rather not.
In .NET Framework 3.5, there isn't a built-in method to convert long file paths to short file paths (8.3 format) without using P/Invoke. However, you can achieve this by using the `System.IO` namespace to manipulate the paths, but you will still need to call Windows APIs to get the short path name. If you're strictly ...
42,441
[ { "from": "human", "value": "Does anyone know how to convert long to short pathnames in .net 3.5 without p/invoke? I can do it with p/invoke if I have to, but I'd rather not.\n" }, { "from": "gpt", "value": "In .NET Framework 3.5, there isn't a built-in method to convert long file paths to shor...
I feel like this is a stupid question because it seems like common sense . . . but no google search I can put together seems to be able to give me the answer! I know how to get data OUT of a sqlite3 database using the .dump command. But now that I have this ASCII file titled export.sqlite3.sql . . . I can't seem to ge...
Don't worry, it's not a stupid question at all! Transferring data into a SQLite database can be a bit tricky if you're not familiar with the commands. Since you've already prepared your SQL dump file (`export.sqlite3.sql`) and ensured that the schema matches in your second Rails app, you can easily import the data usin...
44,082
[ { "from": "human", "value": "I feel like this is a stupid question because it seems like common sense . . . but no google search I can put together seems to be able to give me the answer! \nI know how to get data OUT of a sqlite3 database using the .dump command. But now that I have this ASCII file titled e...
How do you implement a last-modified column in SQL? I know for a date-created column you can just set the default value to getdate(). For last-modified I have always used triggers, but it seems like there must be a better way. Thanks.
Implementing a "last-modified" column in SQL can indeed be done using triggers, but there are simpler approaches that can also work effectively depending on your use case and the specific SQL database you are using. Here are a few common methods: ### 1. Use a `DEFAULT` Value and Update on Application Level One straigh...
42,921
[ { "from": "human", "value": "How do you implement a last-modified column in SQL?\nI know for a date-created column you can just set the default value to getdate(). For last-modified I have always used triggers, but it seems like there must be a better way.\nThanks.\n" }, { "from": "gpt", "value"...
Javascripts are in script.js file which I have called in the xhtml file. But it is throwing error at line where I have calling onpageload function saying " object expected. However, if I have the scripts on same XHTML file, it is working fine.
When you encounter the error "object expected" in JavaScript, it usually means that the script is trying to access an object or function that is not yet available. This can often happen when your JavaScript code runs before the HTML elements have fully loaded or before the functions defined in your external script file...
41,211
[ { "from": "human", "value": "Javascripts are in script.js file which I have called in the xhtml file.\nBut it is throwing error at line where I have calling onpageload function saying \" object expected.\nHowever, if I have the scripts on same XHTML file, it is working fine.\n" }, { "from": "gpt", ...
I'd like to receive a touch event. Also I'd like some kind of coordinates indicating where the user touched the screen. How can I receive a touch event in an iPhone app?
To handle touch events in an iPhone app, you typically override methods in a subclass of `UIView` or `UIViewController`. Here's a step-by-step guide to receiving touch events and getting the coordinates of the touch. ### Step 1: Create a Custom UIView You can create a custom `UIView` subclass to handle touch events. ...
43,587
[ { "from": "human", "value": "I'd like to receive a touch event. Also I'd like some kind of coordinates indicating where the user touched the screen.\nHow can I receive a touch event in an iPhone app?\n" }, { "from": "gpt", "value": "To handle touch events in an iPhone app, you typically overrid...
I have plenty of experience with NUnit and MBUnit, but I'm new to .NET Compact Framework development and I'd like to get off on the right foot. Is there a prevailing unit testing framework for the .NET Compact Framework, and if so, what is it?
For .NET Compact Framework development, the most commonly used unit testing framework is **NUnit**, specifically the version that has been adapted for Compact Framework usage. While NUnit is widely recognized and used in the .NET ecosystem, you will need to ensure you are using the version that is compatible with the C...
44,913
[ { "from": "human", "value": "I have plenty of experience with NUnit and MBUnit, but I'm new to .NET Compact Framework development and I'd like to get off on the right foot.\nIs there a prevailing unit testing framework for the .NET Compact Framework, and if so, what is it?\n" }, { "from": "gpt", ...
I have a control in Silverlight 2 that changes state during the application. When its state changes, I want to update the tooltip that goes with it. I'm using the ToolTipService: ToolTipService.SetToolTip(ent.LayoutRoot, "FooBar"); which works fine the first time I set a tooltip, but fails the second time time around...
The issue you're encountering with updating the tooltip in Silverlight 2 likely stems from the way the `ToolTipService` is managing the tooltip associated with the control. When you set a tooltip for the first time, it works correctly, but it seems that when you attempt to change it again, the previous tooltip instance...
42,067
[ { "from": "human", "value": "I have a control in Silverlight 2 that changes state during the application. When its state changes, I want to update the tooltip that goes with it.\nI'm using the ToolTipService:\nToolTipService.SetToolTip(ent.LayoutRoot, \"FooBar\");\n\nwhich works fine the first time I set a...
Let's assume our average page weights P KBytes and we've got N visits per unit time (let's say, per hour). How could we estimate the number of servers needed to support this load with a reasonable response time?
To estimate the number of servers needed to support a given load characterized by average page weight (P KBytes) and the number of visits (N) per unit time (e.g., per hour), we need to follow these steps: ### Step 1: Calculate Total Data Transfer Per Hour First, we calculate the total data that needs to be served in a...
42,719
[ { "from": "human", "value": "Let's assume our average page weights P KBytes and we've got N visits per unit time (let's say, per hour). How could we estimate the number of servers needed to support this load with a reasonable response time?\n" }, { "from": "gpt", "value": "To estimate the number...
Folks, I am pulling all my Flash (pure AS3 project, not Flash CS3) content from a Drupal back-end for SEO purposes. This works great, except the HTML rendering built into the TextField object leaves a lot to be desired. Could anyone recommend any libraries that would allow me to display HTML elements? At this stage,...
Hello Marcus, If you're looking to render HTML content in a pure ActionScript 3 project, there are a few options you might consider: 1. **TextField with HTML Support**: While the default HTML rendering of `TextField` in ActionScript 3 is limited, you can still use it to display basic HTML. You might want to struct...
43,497
[ { "from": "human", "value": "Folks,\nI am pulling all my Flash (pure AS3 project, not Flash CS3) content from a Drupal back-end for SEO purposes. This works great, except the HTML rendering built into the TextField object leaves a lot to be desired. Could anyone recommend any libraries that would allow me...
Greenspunning. We've all had occasion to hack around a language's missing features to get what we need. Implementing pseudo-monadic patterns in Java, Y Combinators in Javascript, variable immutability in C... What do you consider your most impressive workaround in search of greater functionality? In hindsight, was it...
Greenspunning, or the practice of recreating existing functionality in a programming language that lacks certain features, is an intriguing aspect of software development. One of my most notable workarounds involved implementing a lightweight dependency injection (DI) framework in Java before DI became popularized in t...
40,884
[ { "from": "human", "value": "Greenspunning. We've all had occasion to hack around a language's missing features to get what we need. Implementing pseudo-monadic patterns in Java, Y Combinators in Javascript, variable immutability in C... \nWhat do you consider your most impressive workaround in search of g...
I have an interface A, for which I have to supply a few different implementations. However, those implementations share some helper methods, so I moved those methods to an abstract base class. Interface A { void doX(); } abstract Class B implements A { protected void commonY() { // ... } @Over...
Let's break down your questions regarding the design of the interface and abstract class: ### 1. Should I declare the abstract method `doX()` in Class B? Why (not)? Yes, you should declare the abstract method `doX()` in Class B. The reason for this is that Class B is an abstract class that implements the interface A....
44,219
[ { "from": "human", "value": "I have an interface A, for which I have to supply a few different\nimplementations. However, those implementations share some helper methods, so\nI moved those methods to an abstract base class.\nInterface A {\n void doX();\n}\n\nabstract Class B implements A {\n protected...
In my application, originally built with Delphi 7, I use the SPHelpIntegration code to enable CHM help via the F1 interface. I figured that this wasn't needed in Delphi 2007, so I removed the units and built my app. I then press F1 and get a message that no help interface is installed. The online help doesn't tell me a...
In Delphi 2007, F1 help integration works differently than in Delphi 7, and you need to ensure that your project is set up correctly to use CHM help files. Here are the steps to enable F1 help in Delphi 2007: 1. **Include the Help Files**: You need to ensure that your CHM help file is associated with your project. Yo...
43,998
[ { "from": "human", "value": "In my application, originally built with Delphi 7, I use the SPHelpIntegration code to enable CHM help via the F1 interface. I figured that this wasn't needed in Delphi 2007, so I removed the units and built my app. I then press F1 and get a message that no help interface is ins...
I have a Perl application that parses MediaWiki SQL tables and displays data from multiple wiki pages. I need to be able to re-create the absolute image path to display the images, eg: .../f/fc/Herbs.jpg/300px-Herbs.jpg From MediaWiki Manual: Image_Authorisation: "the [image] path can be calculated easily from the fi...
In MediaWiki, image files are stored in a specific directory structure based on the first few characters of the file name. The path to an image can be reconstructed from the image file name using a standardized approach. Here's how the path is calculated: 1. **File Name**: Let's say your image file name is `Herbs.jpg...
31,273
[ { "from": "human", "value": "I have a Perl application that parses MediaWiki SQL tables and displays data from multiple wiki pages. I need to be able to re-create the absolute image path to display the images, eg: .../f/fc/Herbs.jpg/300px-Herbs.jpg \nFrom MediaWiki Manual:\n\nImage_Authorisation: \"the [ima...
Should I use them as separate releases? Do I check them back into trunk or branches? Is this all in the red book and I've just wasted your time?
It sounds like you're dealing with version control and release management. Here’s a breakdown of your questions: 1. **Separate Releases:** Whether to use separate releases depends on your project and development strategy. If the changes in each version are significant enough to warrant their own release, then yes, you...
45,863
[ { "from": "human", "value": "Should I use them as separate releases? Do I check them back into trunk or branches? Is this all in the red book and I've just wasted your time?\n" }, { "from": "gpt", "value": "It sounds like you're dealing with version control and release management. Here’s a break...
Does anybody know why the following code only has effect in FF? $(document).ready(function() { $('#powerSearchSubmitButton').click(function() { startLoad(); }); }); function startLoad() { $('.message').each(function(i) { $(this).animate({ opacity: 0 }, 500); }); };
The behavior you're observing, where the code only seems to have an effect in Firefox (FF) but not in other browsers, could be due to several reasons related to how animations and event handling are implemented across different browsers. Here are some potential explanations and debugging tips: 1. **Animation Rendering...
42,272
[ { "from": "human", "value": "Does anybody know why the following code only has effect in FF?\n$(document).ready(function() {\n $('#powerSearchSubmitButton').click(function() {\n startLoad();\n });\n});\n\nfunction startLoad() {\n $('.message').each(function(i) {\n $(this).animate({ op...
In some applications (notably Visual Studio 2008, Windows Explorer, Internet Explorer) all of the menus open to the left of the cursor. In other apps (Firefox, ACDSee) they open to the right. Then there's Foxit Reader, where the ones in the menu bar open to the left and the context menu opens to the right. This is very...
In Windows Vista, there is no built-in setting to universally control the direction in which menus open across all applications. The behavior of menus is determined by how individual applications are designed, and developers may choose to implement menu opening behaviors that differ from one another. However, there ar...
42,308
[ { "from": "human", "value": "In some applications (notably Visual Studio 2008, Windows Explorer, Internet Explorer) all of the menus open to the left of the cursor. In other apps (Firefox, ACDSee) they open to the right. Then there's Foxit Reader, where the ones in the menu bar open to the left and the cont...
I very rarely meet any other programmers! My thought when I first saw the token was "implies that" since that's what it would read it as in a mathematical proof but that clearly isn't its sense. So how do I say or read "=>" as in:- IEnumerable<Person> Adults = people.Where(p => p.Age > 16) Or is there even an agreed w...
The `=>` operator is commonly referred to as the "goes to" operator in the context of programming, particularly in languages like C# where it's used in lambda expressions. When you see the expression `p => p.Age > 16`, you can read it as "p goes to p.Age > 16." In the context of the code you've provided, you might sa...
46,518
[ { "from": "human", "value": "I very rarely meet any other programmers!\nMy thought when I first saw the token was \"implies that\" since that's what it would read it as in a mathematical proof but that clearly isn't its sense.\nSo how do I say or read \"=>\" as in:-\nIEnumerable<Person> Adults = people.Wher...
In Python, if I do this: print "4" * 4 I get > "4444" In Perl, I'd get > 16 Is there an easy way to do the former in Perl?
Yes, in Perl, if you want to replicate the behavior of Python's string multiplication (where a string is repeated a specified number of times), you can use the `x` operator. Here's how you can achieve the same result: ```perl print "4" x 4; # This will output: 4444 ``` In this example, the `x` operator in Perl is us...
46,971
[ { "from": "human", "value": "In Python, if I do this:\nprint \"4\" * 4\n\nI get\n> \"4444\"\n\nIn Perl, I'd get\n> 16\n\nIs there an easy way to do the former in Perl?\n" }, { "from": "gpt", "value": "Yes, in Perl, if you want to replicate the behavior of Python's string multiplication (where a ...