instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Assuming Windows, is there a way I can detect from within a batch file if it was launched from an open command prompt or by double-clicking? I'd like to add a pause to the end of the batch process if and only if it was double clicked, so that the window doesn't just disappear along with any useful output it may have p...
Certainly! You can detect whether a batch file was launched from an open command prompt or by double-clicking it using a combination of environment variables and some clever checks. Below is a method that should work on default configurations of Windows. ### Method: 1. When a batch file is executed, it runs in a comm...
48,710
[ { "from": "human", "value": "Assuming Windows, is there a way I can detect from within a batch file if it was launched from an open command prompt or by double-clicking? I'd like to add a pause to the end of the batch process if and only if it was double clicked, so that the window doesn't just disappear a...
I have analyzed a hibernate generated oracle database and discovered that a delete of a row from a single table will spawn the firing of 1200+ triggers in order to delete the related rows in child tables. The triggers are all auto-generated the same - an automatic delete of a child row without checking for existence fi...
In Oracle, you cannot directly use an `IF EXISTS` statement as you might in other DBMSs like SQL Server. However, you can achieve a similar effect by using a `PL/SQL` block or by modifying your triggers to check for the existence of related rows before performing the delete operation. Here’s a general approach you cou...
46,781
[ { "from": "human", "value": "I have analyzed a hibernate generated oracle database and discovered that a delete of a row from a single table will spawn the firing of 1200+ triggers in order to delete the related rows in child tables. The triggers are all auto-generated the same - an automatic delete of a ch...
Can anyone provide (or point me to) example sql code for logging exceptions using Enterprise Library Exception Handling Application Block (EHAB)? ie I'd like standard CREATE TABLE and CREATE PROCEDURE statements for the structures and procs to store logged exceptions in a SQL Server database. Also, can anyone describe ...
To set up logging exceptions using the Enterprise Library Exception Handling Application Block (EHAB) in .NET 2.0, you will need to create a SQL Server database table to store the logged exceptions and a stored procedure to handle inserting log entries. Below is an example of how to create a table and stored procedure...
43,523
[ { "from": "human", "value": "Can anyone provide (or point me to) example sql code for logging exceptions using Enterprise Library Exception Handling Application Block (EHAB)? ie I'd like standard CREATE TABLE and CREATE PROCEDURE statements for the structures and procs to store logged exceptions in a SQL Se...
Is it possible to import a directory tree into subversion if a large number of the files already exist in the repository? Many of the files that will be imported will match those in the repository, both in path and content, but some will be older, and some will be newer, and some files will be in either the repo or the...
Yes, it is possible to import a directory tree into a Subversion (SVN) repository while preserving the history of existing files and handling conflicts. However, the straightforward `svn import` command is not designed for this purpose since it doesn't handle files that already exist in the repository. To achieve your...
49,651
[ { "from": "human", "value": "Is it possible to import a directory tree into subversion if a large number of the files already exist in the repository? Many of the files that will be imported will match those in the repository, both in path and content, but some will be older, and some will be newer, and som...
With JSR 311 and its implementations we have a powerful standard for exposing Java objects via REST. However on the client side there seems to be something missing that is comparable to Apache Axis for SOAP - something that hides the web service and marshals the data transparently back to Java objects. How do you creat...
Creating Java RESTful clients can be approached in several ways, depending on your needs and preferences. While JSR 311 (Java API for RESTful Web Services) provides a standard for creating REST services, there isn't a one-size-fits-all client equivalent to what Apache Axis offers for SOAP. However, there are several po...
43,360
[ { "from": "human", "value": "With JSR 311 and its implementations we have a powerful standard for exposing Java objects via REST. However on the client side there seems to be something missing that is comparable to Apache Axis for SOAP - something that hides the web service and marshals the data transparent...
Mostly for my amusement, I created a makefile in my $HOME/bin directory called rebuild.mk, and made it executable, and the first lines of the file read: #!/bin/make -f # # Comments on what the makefile is for ... all: ${SCRIPTS} ${LINKS} ... ... I can now type: rebuild.mk and this causes make to execute. What are ...
Using a Makefile as an executable script in the way you've described certainly has its quirks and can be amusing or convenient for specific use cases. However, as you've already pointed out, there are several reasons one might choose not to adopt this technique as a permanent solution. Here are some considerations: ##...
48,111
[ { "from": "human", "value": "Mostly for my amusement, I created a makefile in my $HOME/bin directory called rebuild.mk, and made it executable, and the first lines of the file read:\n#!/bin/make -f\n#\n# Comments on what the makefile is for\n\n...\n\nall: ${SCRIPTS} ${LINKS} ...\n\n...\n\nI can now type:\nr...
How do you (in Visual Studio) compare the controls in the different templates in a formview so you can track down a ViewState error?
When you're dealing with ViewState issues in a FormView in Visual Studio, comparing controls across different templates can be a helpful way to debug. Here’s a step-by-step approach to track down a ViewState error by comparing the controls in the different templates: ### Step 1: Identify the Templates 1. **Open Your ...
46,490
[ { "from": "human", "value": "How do you (in Visual Studio) compare the controls in the different templates in a formview so you can track down a ViewState error? \n" }, { "from": "gpt", "value": "When you're dealing with ViewState issues in a FormView in Visual Studio, comparing controls across...
Duplicate Of : Find node clicked under context menu I've got a context menu on a Treeview, when the user right clicks it supposed to change based on the currently right clicked node's tag object. Currently I'm updating the context menu in after_select event, however this doesn't work when user right clicks to another n...
To dynamically update a context menu based on the node that was right-clicked in a Treeview, you should handle the right-click event separately from the selection event. Specifically, you can bind to the `MouseDown` event of the Treeview control and check if the right mouse button was clicked. Then, you can retrieve th...
44,876
[ { "from": "human", "value": "Duplicate Of : Find node clicked under context menu\nI've got a context menu on a Treeview, when the user right clicks it supposed to change based on the currently right clicked node's tag object.\nCurrently I'm updating the context menu in after_select event, however this doesn...
Just as the title says, I see a lot of editors touting macro recording as a feature but cannot find a way to take advantage of these functions myself. So what can you use it for? The type where you can record mouse movement and/or keystrokes? Is it really that helpful to people out there? Specifically, I deal with ...
Macro recording can be a powerful feature in various software applications, including text editors, IDEs (like Eclipse), and even general-purpose applications. Here are some ways you might find macro recording useful, as well as some advantages and considerations specific to Eclipse: ### What You Can Use Macros For: 1...
48,706
[ { "from": "human", "value": "Just as the title says, I see a lot of editors touting macro recording as a feature but cannot find a way to take advantage of these functions myself. So what can you use it for? The type where you can record mouse movement and/or keystrokes? Is it really that helpful to peop...
Is there a way to sniff SQL queries sent to a SQL Server db on any level (above transport level)? Perhaps there's some kind of a tracer in ASP.NET or built-in log in SQL Server ?
Yes, there are several ways to capture and analyze SQL queries sent to a SQL Server database, beyond just sniffing the transport layer. Here are some options you can explore: ### 1. **SQL Server Profiler** SQL Server Profiler is a graphical tool that allows you to monitor and capture SQL Server events. You can create ...
46,990
[ { "from": "human", "value": "Is there a way to sniff SQL queries sent to a SQL Server db on any level (above transport level)? Perhaps there's some kind of a tracer in ASP.NET or built-in log in SQL Server ? \n" }, { "from": "gpt", "value": "Yes, there are several ways to capture and analyze S...
It looks like all the methods for loading SQLite involve loading from a named file using a string. I would like to load SQlite database from memory. The database is already loaded into memory.
SQLite provides a special way to create and use a database entirely in memory using the `:memory:` special filename. This allows you to create a database that exists only in RAM and is not stored on disk. Here's how you can load and use an SQLite database from memory in Python using the `sqlite3` library. 1. **Creatin...
47,729
[ { "from": "human", "value": "It looks like all the methods for loading SQLite involve loading from a named file using a string. I would like to load SQlite database from memory.\nThe database is already loaded into memory.\n" }, { "from": "gpt", "value": "SQLite provides a special way to create...
What are the best algorithms for recognizing structured data on an HTML page? For example Google will recognize the address of home/company in an email, and offers a map to this address.
Recognizing structured data on an HTML page, such as addresses or other entities, typically involves using a combination of algorithms and techniques from natural language processing (NLP), machine learning, and web scraping. Below are some of the best algorithms and methods for achieving this: ### 1. **Named Entity R...
44,472
[ { "from": "human", "value": "What are the best algorithms for recognizing structured data on an HTML page?\nFor example Google will recognize the address of home/company in an email, and offers a map to this address.\n" }, { "from": "gpt", "value": "Recognizing structured data on an HTML page, s...
I'm trying to annotate some text onto a base image with a dropshadow. I don't like the results I get from using the -shadow option, so I'm putting down the text, blurring it, then putting down the text again in white, a few pixels offset from the shadow. Here's the command I'm using: convert base_image.jpg \ -f...
You're on the right track with using parentheses to isolate the commands, but it looks like the blurring is still affecting the entire image because of the sequence in which you're applying your operations. To achieve the desired effect, you need to create a separate layer for the blurred shadow and then composite it o...
48,114
[ { "from": "human", "value": "I'm trying to annotate some text onto a base image with a dropshadow. I don't like the results I get from using the -shadow option, so I'm putting down the text, blurring it, then putting down the text again in white, a few pixels offset from the shadow. Here's the command I'm u...
I have a button control style and I want to change the padding from whatever the data-bound version is to adjust for a glyph that needs a 2 pixel offset. I'll use SimpleButton from SimpleStyles.xaml as an example (... shows where the trigger code was removed for conciseness): <Style x:Key="SimpleButton" TargetType="{x...
In XAML, you cannot directly perform arithmetic operations on values like `Padding`. However, there are some common approaches to achieve the desired effect of adjusting padding or margins. ### 1. Use a Custom Control or Behavior One way to adjust the padding programmatically is to create a custom control or use a beh...
48,199
[ { "from": "human", "value": "I have a button control style and I want to change the padding from whatever the data-bound version is to adjust for a glyph that needs a 2 pixel offset. I'll use SimpleButton from SimpleStyles.xaml as an example (... shows where the trigger code was removed for conciseness):\n...
Let me start off by saying that I know there is probably a much simpler way to do this. But this is what i have and yes hopefully I can make some improvements and/or simplifications at the end. Goal as of this moment To double space the output stored in the $tmp variable below and individually number each line. Doing t...
It looks like you are trying to process a file and manipulate the output, specifically by double-spacing the output and numbering each line. Below is a simplified and improved version of your script, which addresses your goals. ### Key Improvements: 1. **Double-spacing the output**: You can achieve this using the `awk...
45,981
[ { "from": "human", "value": "Let me start off by saying that I know there is probably a much simpler way to do this.\nBut this is what i have and yes hopefully I can make some improvements and/or simplifications at the end.\nGoal as of this moment\nTo double space the output stored in the $tmp variable belo...
the following js works fine in FF2 but in IE6 the dropdown always selects one option to early, IE -> testix2 vs. FF2 -> testix3 If we add an alertBox somewhere in the script, it also works fine in IE6. But how to solve this without an alertBox? tia <script language="JavaScript" type="text/javascript"> <!-- function Ent...
The issue you're encountering with Internet Explorer 6 appears to be related to how the `selected` property of `<option>` elements is being handled during the loop that populates the dropdown. Specifically, the way you set the `selected` property within the loop can lead to incorrect selection, especially in older brow...
48,485
[ { "from": "human", "value": "the following js works fine in FF2 but in IE6 the dropdown always selects one option to early, IE -> testix2 vs. FF2 -> testix3\nIf we add an alertBox somewhere in the script, it also works fine in IE6.\nBut how to solve this without an alertBox?\ntia\n<script language=\"JavaScr...
I posted this question yesterday evening, which has led me to discover a huge problem! I have a decimal column in my database called Units, anytime I set the value of the column to a NON ZERO, and SubmitChanges the column updates with the new value. If I try to set the value of the column to ZERO, the SubmitChanges do...
It sounds like you encountered a common issue with ORM (Object-Relational Mapping) frameworks like LINQ to SQL when dealing with default values in the database. When you set a property to its default value (in this case, zero for a decimal column), the ORM might not recognize that as a change because it believes the va...
48,547
[ { "from": "human", "value": "I posted this question yesterday evening, which has led me to discover a huge problem!\nI have a decimal column in my database called Units, anytime I set the value of the column to a NON ZERO, and SubmitChanges the column updates with the new value. If I try to set the value o...
I have a large number of files in a ClearCase directory structure, and I need to go through and change all "makefile" to "Makefile". I'm thinking some combination of the find . -name makefile command with an exec flag, but I'm having a hard time coming up with the exec command. The cleartool mv command does not automat...
To achieve your goal of renaming all `makefile` files to `Makefile` in a ClearCase directory structure, while checking out the directories first, you can use a combination of `find`, `cleartool`, and a shell loop. Below are the commands that would work in a Cygwin environment. ### Using Cygwin or Bash 1. Open your Cy...
47,684
[ { "from": "human", "value": "I have a large number of files in a ClearCase directory structure, and I need to go through and change all \"makefile\" to \"Makefile\". I'm thinking some combination of the find . -name makefile command with an exec flag, but I'm having a hard time coming up with the exec comma...
I understand that programming to interfaces helps with loose coupling. However, is there a guideline that explains when its most effective? For example, I have a simple web application that collects data on employees, their training plans, expenses and computes their expense for the year etc. This is a fairly simple ap...
Your question touches on a critical aspect of software design: finding the right balance between simplicity and flexibility. While programming to interfaces is a principle that promotes loose coupling and enhances maintainability, it may not always be necessary in simpler applications. Here are some guidelines to help ...
47,330
[ { "from": "human", "value": "I understand that programming to interfaces helps with loose coupling. However, is there a guideline that explains when its most effective?\nFor example, I have a simple web application that collects data on employees, their training plans, expenses and computes their expense fo...
I've got a simple class that inherits from Collection and adds a couple of properties. I need to serialize this class to XML, but the XMLSerializer ignores my additional properties. I assume this is because of the special treatment that XMLSerializer gives ICollection and IEnumerable objects. What's the best way around...
To serialize additional properties from a class that inherits from `Collection<T>` (or `ICollection`), you can override the `GetObjectData` method or change the way the serialization is handled by using a wrapper class. However, the simplest approach is to create a new class to represent your collection, which contain...
48,756
[ { "from": "human", "value": "I've got a simple class that inherits from Collection and adds a couple of properties. I need to serialize this class to XML, but the XMLSerializer ignores my additional properties.\nI assume this is because of the special treatment that XMLSerializer gives ICollection and IEnum...
I'm trying to test the functionality of a web app by scripting a login sequence in Python, but I'm having some troubles. Here's what I need to do: Do a POST with a few parameters and headers. Follow a redirect Retrieve the HTML body. Now, I'm relatively new to python, but the two things I've tested so far haven't wor...
When working with HTTP requests in Python, especially for web scraping or automating tasks like logging into a web application, it’s common to run into issues with redirects and session management (like cookies). The libraries you tried (`httplib` and `urllib/urllib2`) can be somewhat low-level and don't manage cookies...
45,833
[ { "from": "human", "value": "I'm trying to test the functionality of a web app by scripting a login sequence in Python, but I'm having some troubles.\nHere's what I need to do:\n\nDo a POST with a few parameters and headers.\nFollow a redirect\nRetrieve the HTML body.\n\nNow, I'm relatively new to python, b...
Presuming I have a class named A, and I want to use the decorator design pattern. Correct me if I'm wrong, but for that to work , we'll need to create a decorator class, say ADecorator, which will hold a reference to an A instance, and all the other decorators will extend this to add functionality. I don't understand w...
You are correct in your understanding of the decorator design pattern, and it is a common point of confusion, so let's clarify why we typically create a decorator class. ### Purpose of the Decorator Class 1. **Adhering to the Open/Closed Principle**: The decorator pattern is intended to allow you to add behavior to a...
46,099
[ { "from": "human", "value": "Presuming I have a class named A, and I want to use the decorator design pattern. Correct me if I'm wrong, but for that to work , we'll need to create a decorator class, say ADecorator, which will hold a reference to an A instance, and all the other decorators will extend this t...
I have written a new custom component derived from TLabel. The component adds some custom drawing to component, but nothing else. When component is painted, everything works fine. But when the redraw is needed (like dragging another window over the component), "label part" works fine but my custom drawing is not proper...
It sounds like you've encountered a common issue when working with custom drawing in Delphi components. The problem you faced with the `FloodFill` function is indeed something that can lead to artifacts or incorrect rendering when the component is not fully visible or when parts of it need to be redrawn. Here’s a brie...
46,729
[ { "from": "human", "value": "I have written a new custom component derived from TLabel. The component adds some custom drawing to component, but nothing else. When component is painted, everything works fine. But when the redraw is needed (like dragging another window over the component), \"label part\" wor...
I have around 8-9 parameters to pass in a function which returns an array. I would like to know that its better to pass those parameters directly in the function or pass an array instead? Which will be a better way and why?
When deciding whether to pass multiple parameters directly or as an array (or object), there are several factors to consider. Here are some points to help you make your decision: ### Advantages of Passing Parameters Directly 1. **Clarity**: When you pass parameters directly, it can be easier to understand what each p...
47,664
[ { "from": "human", "value": "I have around 8-9 parameters to pass in a function which returns an array. I would like to know that its better to pass those parameters directly in the function or pass an array instead? Which will be a better way and why?\n" }, { "from": "gpt", "value": "When decid...
If I strong name a class library with a .snk file, do I need to replace this .snk file with a new if I create a new version of the same library?
When you strong name a class library using a .snk (strong name key) file, the purpose of the .snk file is to provide a unique identity to your assembly. This identity is determined by the public key contained in the .snk file, along with the assembly's version number and name. If you are creating a new version of the ...
48,427
[ { "from": "human", "value": "If I strong name a class library with a .snk file, do I need to replace this .snk file with a new if I create a new version of the same library?\n" }, { "from": "gpt", "value": "When you strong name a class library using a .snk (strong name key) file, the purpose of ...
For learning and demonstrating, I need a macro which prints its parameter and evaluates it. I suspect it is a very common case, may be even a FAQ but I cannot find actual references. My current code is: #define PRINT(expr) (fprintf(stdout, "%s -> %d\n", __STRING(expr), (expr))) and then: PRINT(x & 0x01); It works fin...
Your `PRINT` macro is a clever way to print both the expression and its evaluated result, but you're right to be cautious about using the `__STRING` macro because it is part of the implementation-defined macros. It's in the double underscore namespace, which generally means it might not be guaranteed to be available ac...
48,719
[ { "from": "human", "value": "For learning and demonstrating, I need a macro which prints its parameter and evaluates it. I suspect it is a very common case, may be even a FAQ but I cannot find actual references.\nMy current code is:\n#define PRINT(expr) (fprintf(stdout, \"%s -> %d\\n\", __STRING(expr), (exp...
Ok, i have simple scenario: have two pages: login and welcome pages. im using FormsAuthentication with my own table that has four columns: ID, UserName, Password, FullName When pressed login im setting my username like: FormsAuthentication.SetAuthCookie(userName, rememberMe ?? false); on the welcome page i cant use: P...
To achieve your requirement of using the `FullName` field from your database instead of the `UserName` for displaying the current user on the welcome page, you have several options. Since you're using Forms Authentication, you can store custom data in the authentication ticket to avoid hitting the database for every pa...
48,714
[ { "from": "human", "value": "Ok, i have simple scenario:\nhave two pages:\nlogin and welcome pages.\nim using FormsAuthentication with my own table that has four columns: ID, UserName, Password, FullName\nWhen pressed login im setting my username like:\nFormsAuthentication.SetAuthCookie(userName, rememberMe...
Using ext/ldap I'm trying to add entries to an Active Directory. As long as I only use one single structural objectClass everything works as expected, but as soon as I try to add an entry with a second auxiliary objectClass, the server reports an error: Server is unwilling to perform; 00002040: SvcErr: DSID-030F0AA0, ...
In Active Directory, not all object classes are compatible with one another, particularly when it comes to auxiliary object classes. The error you are encountering is likely due to the fact that the `domainRelatedObject` auxiliary object class has specific requirements regarding the attributes that must be present or c...
45,687
[ { "from": "human", "value": "Using ext/ldap I'm trying to add entries to an Active Directory. As long as I only use one single structural objectClass everything works as expected, but as soon as I try to add an entry with a second auxiliary objectClass, the server reports an error:\n\nServer is unwilling to...
I have a registry value which is stored as a binary value (REG_BINARY) holding information about a filepath. The value is read out into an byte array. But how can I transform it into a readable string? I have read about system.text.encoding.ASCII.GetString(value) but this does not work. As far as I got to know the regi...
It appears that the binary data in your registry value is encoded in UTF-16LE (also known as UCS-2 Little Endian), which is a character encoding that represents characters as two bytes each. The pattern you're observing, where each character is followed by a null byte (like `c 00` for `c`), suggests that the data is in...
46,531
[ { "from": "human", "value": "I have a registry value which is stored as a binary value (REG_BINARY) holding information about a filepath. The value is read out into an byte array. But how can I transform it into a readable string?\nI have read about system.text.encoding.ASCII.GetString(value) but this does ...
Sometimes software installers force you to scroll to the end of the EULA before the “I agree” box is enabled. How can I produce the same effect on a web page?
To create a similar effect on a web page, you can use HTML, CSS, and JavaScript to ensure users scroll through the content of an End User License Agreement (EULA) before enabling the "I Agree" button. Below is a simple example of how you could implement this functionality. ### HTML Structure ```html <!DOCTYPE html> <...
45,712
[ { "from": "human", "value": "Sometimes software installers force you to scroll to the end of the EULA before the “I agree” box is enabled. How can I produce the same effect on a web page?\n" }, { "from": "gpt", "value": "To create a similar effect on a web page, you can use HTML, CSS, and JavaS...
I set up a simple event handler as mentioned here, but it appears that the selector isn't called. I put the code in my AppDelegate class and wired up the delegate in IB. Tried putting in some NSLog()s and breakpoints in the selector I expect to be called, but none of it is hit. The URL scheme works inasmuch as it launc...
It sounds like you're trying to handle a custom URL scheme in your iOS app, but the appropriate event handler is not being triggered. Here are some steps you can take to troubleshoot the issue: ### 1. Ensure URL Scheme is Set Up Correctly Make sure that your URL scheme is set up correctly in your app's Info.plist. Her...
46,578
[ { "from": "human", "value": "I set up a simple event handler as mentioned here, but it appears that the selector isn't called. I put the code in my AppDelegate class and wired up the delegate in IB. Tried putting in some NSLog()s and breakpoints in the selector I expect to be called, but none of it is hit. ...
I've got two branches that are fully merged together. However, after the merge is done, I realise that one file has been messed up by the merge (someone else did an auto-format, gah), and it would just be easier to change to the new version in the other branch, and then reinsert my one line change after bringing it ove...
To resolve the issue you've described in Git, you can follow these steps to use a specific file from another branch and then apply your changes. Here’s a step-by-step guide: 1. **Check out the branch where you want to apply the changes** (assuming it's called `my-branch`): ```bash git checkout my-branch ``` ...
48,544
[ { "from": "human", "value": "I've got two branches that are fully merged together.\nHowever, after the merge is done, I realise that one file has been messed up by the merge (someone else did an auto-format, gah), and it would just be easier to change to the new version in the other branch, and then reinser...
I am looking for a way to localize properties names displayed in a PropertyGrid. The property's name may be "overriden" using the DisplayNameAttribute attribute. Unfortunately attributes can not have non constant expressions. So I can not use strongly typed resources such as: class Foo { [DisplayAttribute(Resources...
To localize property names in a `PropertyGrid`, while still using strongly typed resources, there are a few approaches you can take. The key challenge is that attributes in C# require constant values and cannot use non-constant expressions like resource lookups directly. Here are some options to consider: ### 1. Crea...
47,138
[ { "from": "human", "value": "I am looking for a way to localize properties names displayed in a PropertyGrid. The property's name may be \"overriden\" using the DisplayNameAttribute attribute. Unfortunately attributes can not have non constant expressions. So I can not use strongly typed resources such as: ...
I'm about to start a project where programmers will be contributing from their homes (much like stackoverflow was built) I want to use some centralized source control, but I don't want it to require the programmers to be online, and the server may come offline from time to time (as at first it'll probably be my desktop...
It sounds like you're looking for a source control solution that allows for offline work and asynchronous communication, possibly by email. Here are a few options and concepts that might meet your needs: ### 1. **Git with Email Workflow** While Git itself does not support direct email check-ins out of the box, you can...
46,108
[ { "from": "human", "value": "I'm about to start a project where programmers will be contributing from their homes (much like stackoverflow was built)\nI want to use some centralized source control, but I don't want it to require the programmers to be online, and the server may come offline from time to time...
I'm kind of interested in getting some feedback about this technique I picked up from somewhere. I use this when a function can either succeed or fail, but you'd like to get more information about why it failed. A standard way to do this same thing would be with exception handling, but I often find it a bit over the to...
Your technique for handling success and failure in functions, particularly in a language like PHP, has some pros and cons. Let’s break down the feedback: ### Pros 1. **Simplicity and Readability**: The use of constants for various
6,905
[ { "from": "human", "value": "I'm kind of interested in getting some feedback about this technique I picked up from somewhere.\nI use this when a function can either succeed or fail, but you'd like to get more information about why it failed. A standard way to do this same thing would be with exception handl...
If an application† crashes, I hit "Debug" and Visual Studio is my currently registered Just-In-Time (JIT) debugger: Visual Studio appears, but there's no way to debug anything: I do not see any disassembly I do not see any registers (assuming it runs on a CPU with registers) The call stack is empty (assuming the CP...
To debug a process with Visual Studio that crashes and doesn't provide any debugging information (like source code or symbols), you can follow these steps: ### Step 1: Start Visual Studio with the Crashing Process 1. **Attach to Process**: - Open Visual Studio. - Go to `Debug` -> `Attach to Process...` (or pres...
47,690
[ { "from": "human", "value": "If an application† crashes,\n\nI hit \"Debug\" and Visual Studio is my currently registered Just-In-Time (JIT) debugger:\n\nVisual Studio appears, but there's no way to debug anything:\n\n\nI do not see any disassembly\nI do not see any registers (assuming it runs on a CPU with ...
I've got an array of objects in json format: [ { "name": "obj1", "list": [ "elem1", "elem2", "elem3" ] }, { "name": "obj2", "list": [ "elem4", "elem5", "elem6" ] } ] Now I'd like to ...
To remove the quotation marks around the elements in the `list` arrays of your JSON object, you can use a combination of JavaScript functions and a regular expression. Here's how you can achieve that: 1. Parse the JSON string into a JavaScript object. 2. Iterate through each object, then iterate through each `list` el...
49,527
[ { "from": "human", "value": "I've got an array of objects in json format: \n[\n {\n \"name\": \"obj1\",\n \"list\": [\n \"elem1\",\n \"elem2\",\n \"elem3\"\n ]\n },\n {\n \"name\": \"obj2\",\n \"list\": [\n \"elem4\",\n ...
If you click on the 'search' button in the following link link text A gridview shows up. I am trying to do something similar within a table whose width is set to auto. My current way is to create the gridview in design view, but however, my gridview does not resize to the table width. I understand that I posed 2 differ...
To make your `GridView` responsive and ensure that it resizes to the width of the table or the container it is placed in, you can take a few steps. Here are some suggestions: ### 1. **Set Widths Appropriately:** Remove the fixed widths from your `ItemStyle` properties to allow the grid to adjust its columns based on t...
47,433
[ { "from": "human", "value": "If you click on the 'search' button in the following link\nlink text\nA gridview shows up. I am trying to do something similar within a table whose width is set to auto. My current way is to create the gridview in design view, but however, my gridview does not resize to the tabl...
I can't seem to get it to work. It works fine in Firefox, but in IE nothing happens when the droppable has an item held over it. I tried using the hoverClass option, and also tried just manually changing the class in "over" and "out" events. Both methods work in Firefox, but not IE. Is there a work-around for IE? Belo...
It sounds like you're experiencing a compatibility issue with Internet Explorer (IE) when trying to handle the `over` and `out` events for a droppable element. This can happen due to various reasons related to event handling and CSS classes in different browsers. To address this issue, you can try a few workarounds: ...
49,190
[ { "from": "human", "value": "I can't seem to get it to work. It works fine in Firefox, but in IE nothing happens when the droppable has an item held over it. \nI tried using the hoverClass option, and also tried just manually changing the class in \"over\" and \"out\" events. Both methods work in Firefox, b...
I'm new to the forum and very new to silverlight. Myself and my coworker are working on a custom application. We are building a menu system that will only display buttons if that useris in an assigned role. A new property was created to allow roles to be defined, and for testing purposes we are simply trying to assi...
It looks like you're working with a custom Silverlight control and trying to bind a dependency property (`AllowedRoles`) to a `TextBlock`'s `Text` property. It seems that you're on the right track, but there are a few things to consider to ensure that the binding works correctly. ### Here are some steps to troubleshoo...
42,647
[ { "from": "human", "value": "I'm new to the forum and very new to silverlight. Myself and my coworker are working on a custom application. We are building a menu system that will only display buttons if that useris in an assigned role. A new property was created to allow roles to be defined, and for test...
I've used the setargv.obj linking for expanding wildcard arguments in the past for a number of C and C++ applications, but I can't find any similar mention for .NET applications. Is there a standard way to have your application's command line parameters automatically wildcard expanded? (i.e., expand *.doc from one entr...
In .NET, there isn't a built-in mechanism similar to the C/C++ `setargv.obj` for automatic wildcard expansion of command line arguments. However, your current approach using `Directory.GetFiles()` is a good and common method for handling this scenario. To enhance your implementation to also handle wildcards with paths,...
47,741
[ { "from": "human", "value": "I've used the setargv.obj linking for expanding wildcard arguments in the past for a number of C and C++ applications, but I can't find any similar mention for .NET applications.\nIs there a standard way to have your application's command line parameters automatically wildcard e...
I have been using JBPM workflow in my project and I have a small question regarding generating the database patches or SQL statements to apply JBPM workflow modifications. Currently JBPM workflow provides a way to refresh the JBPM tables in schema with the deployment of the latest process definitions. However what if ...
Generating delta database scripts for jBPM (Java Business Process Model) modifications while preserving existing instances can indeed be a challenge, as the default deployment process can lead to the loss of data associated with previous process definitions. Here are a few strategies and tools that might help you manag...
48,749
[ { "from": "human", "value": "I have been using JBPM workflow in my project and I have a small question regarding generating the database patches or SQL statements to apply JBPM workflow modifications. \nCurrently JBPM workflow provides a way to refresh the JBPM tables in schema with the deployment of the la...
I am new to Silverlight 2.0 and I am actually trying to deploy the Silverlight as webpart in Sharepoint 2007. I have done the following Installations: VS 2008 with SP1 Silverlight 2.0 SDK and exe Silverlight Tools for VS 2008 MOSS 2007 I have created the sample Silverlight application and got the xap file from the bi...
It looks like you've taken many of the necessary steps to deploy a Silverlight 2.0 application as a web part in SharePoint 2007, but there are a few common issues and additional steps you may want to check to ensure everything is set up correctly: 1. **XAP File Location**: Make sure that the `XAPSource` property point...
48,374
[ { "from": "human", "value": "I am new to Silverlight 2.0 and I am actually trying to deploy the Silverlight as webpart in Sharepoint 2007.\nI have done the following Installations:\n\nVS 2008 with SP1\nSilverlight 2.0 SDK and exe\nSilverlight Tools for VS 2008\nMOSS 2007\n\nI have created the sample Silverl...
I have a base class in which I want to specify the methods a child class must have, but not implement them itself. However, the methods in a child class may have a different number of paramaters to the definition in the base class. Having tried this with an abstract method, php doesn't allow this. Is it possible?
In PHP, you can use abstract methods to define the signature of methods that must be implemented by child classes. However, PHP does not allow child classes to have methods with a different number of parameters than defined in the abstract class. This means that if you declare an abstract method in a base class with a ...
48,124
[ { "from": "human", "value": "I have a base class in which I want to specify the methods a child class must have, but not implement them itself. However, the methods in a child class may have a different number of paramaters to the definition in the base class.\nHaving tried this with an abstract method, php...
I need to check whether the user executing the script has administrative privileges on the machine. I have specified the user executing the script because the script could have been executed with a user other than the logged on using something similar to "Runas". @Javier: Both solutions work in a PC with an English ver...
To check if a user executing a script has administrative privileges in a way that works across different language configurations in Windows, you can use PowerShell. PowerShell allows you to check for group membership using a more universal method instead of relying on specific group names. Here’s how you can achieve th...
45,295
[ { "from": "human", "value": "I need to check whether the user executing the script has administrative privileges on the machine.\nI have specified the user executing the script because the script could have been executed with a user other than the logged on using something similar to \"Runas\".\n@Javier: Bo...
Address records are probably used in most database, but I've seen a number of slightly different sets of fields used to store them. The number of fields seems to vary from 3-7, and sometimes all fields are simple labelled address1..addressN, other times given specific meaning (town, city, etc). This is UK specific, tho...
Your proposed structure for storing address records in the UK appears to strike a reasonable balance between providing enough detail for most applications while keeping the design relatively simple. Let’s break down the fields you've chosen: 1. **Address 1**: This is typically where you capture the house number and st...
46,439
[ { "from": "human", "value": "Address records are probably used in most database, but I've seen a number of slightly different sets of fields used to store them. The number of fields seems to vary from 3-7, and sometimes all fields are simple labelled address1..addressN, other times given specific meaning (t...
I am building an application that is very similar to a shopping cart. The user selects a product from a list, and then based on that product, a few properties need to be set and saved. Example. If the user selects a type of paint that allows custom color matches, then I must allow them to enter in a formula number tha...
Designing an application that handles different properties based on product selection, especially in cases like customizable products, can indeed be challenging. There are a few common design patterns and principles that can help you manage this complexity elegantly. ### Option 1: Subclasses for Product Types One str...
47,120
[ { "from": "human", "value": "I am building an application that is very similar to a shopping cart. The user selects a product from a list, and then based on that product, a few properties need to be set and saved.\nExample.\nIf the user selects a type of paint that allows custom color matches, then I must ...
Up till now I have been developing my personal and school projects at home without using any form of revision control software to handle my changes and whatnot. My question is, how feasible is it to use a Version Control application (such as TortoiseSVN) for personal projects I do for myself (and even school projects) ...
Using a version control system (VCS) like TortoiseSVN (or Git, which is more commonly used today) for personal and school projects is not just feasible; it can significantly enhance your workflow and project management. Here are several reasons why it's worth considering: ### Advantages of Using Version Control: 1. *...
47,653
[ { "from": "human", "value": "Up till now I have been developing my personal and school\nprojects at home without using any form of revision control\nsoftware to handle my changes and whatnot.\nMy question is, how feasible is it to use a Version\nControl application (such as TortoiseSVN) for\npersonal projec...
i have a few classes that i am trying to move to using generics Class1: Curve this class has the following code: public class Curve : IEnumerable IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); // Calls non-interface method } public RTRatePointEnumerator GetEnumerator() { ...
To convert your `Curve` and `CurvePointEnumerator` classes to use generics, you need to follow these steps: 1. Update the `Curve` class to be generic so it can work with any type, allowing you to specify the type of elements it contains. 2. Update the enumerator to also be generic, so it can iterate over the same type...
45,637
[ { "from": "human", "value": "i have a few classes that i am trying to move to using generics\nClass1: Curve\nthis class has the following code:\npublic class Curve : IEnumerable\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n return GetEnumerator(); // Calls non-interface method\n }\n\n pub...
I want to use jQuery with a GridView which contains textboxes, but I'm stuck on how to get event listeners registered for every textbox on the selected row. I was thinking I could do something with a StingBuilder in the Unload event of the GridView but I can't get it working.
To attach event listeners to textboxes within a GridView using jQuery, you can handle it in a more dynamic way without relying on server-side `StringBuilder` or any server-side events. Instead, you can use jQuery's event delegation to bind event listeners to the textboxes in the selected row of the GridView. Here’s a...
47,748
[ { "from": "human", "value": "I want to use jQuery with a GridView which contains textboxes, but I'm stuck on how to get event listeners registered for every textbox on the selected row. I was thinking I could do something with a StingBuilder in the Unload event of the GridView but I can't get it working.\n"...
Pour in your posts. I'll start with a couple, let us see how much we can collect. To provide inline event handlers like button.Click += (sender,args) => { }; To find items in a collection var dogs= animals.Where(animal => animal.Type == "dog"); For iterating a collection, like animals.ForEach(animal=>Console.WriteL...
Great! Here are some additional C# code snippets to add to your collection: 1. **Using LINQ to select specific properties:** ```csharp var dogNames = animals.Where(animal => animal.Type == "dog") .Select(animal => animal.Name); ``` 2. **Creating a list of items:** ```csharp var...
45,368
[ { "from": "human", "value": "Pour in your posts. I'll start with a couple, let us see how much we can collect.\nTo provide inline event handlers like\nbutton.Click += (sender,args) =>\n{\n};\n\nTo find items in a collection\n var dogs= animals.Where(animal => animal.Type == \"dog\");\n\nFor iterating a coll...
I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database. I suspected file permissions as the culp...
It sounds like you're facing a few potential issues with your SQLite database updates in PHP. Here are several steps you can take to troubleshoot and resolve the issue: 1. **Ensure Autocommit is Enabled**: By default, SQLite operates in autocommit mode, but if you have started a transaction with `BEGIN`, you need to m...
2,853
[ { "from": "human", "value": "I've been trying to use SQLite with the PDO wrapper in PHP with mixed success. I can read from the database fine, but none of my updates are being committed to the database when I view the page in the browser. Curiously, running the script from my shell does update the database....
I'm asking myself if it is possible to check if in ADO.NET the current transaction can be rolled back. The msdn suggests the following implementation: private static void ExecuteSqlTransaction(string connectionString) { using (SqlConnection connection = new SqlConnection(connectionString)) { connection....
In ADO.NET, the ability to determine whether a transaction can be rolled back is indeed tied to the transaction's state. However, as you noted, there isn't a built-in, database-independent way to check the state of a transaction before calling `Rollback()`. Here are some points to consider regarding transactions and ...
46,650
[ { "from": "human", "value": "I'm asking myself if it is possible to check if in ADO.NET the current transaction can be rolled back.\nThe msdn suggests the following implementation:\nprivate static void ExecuteSqlTransaction(string connectionString)\n{\n using (SqlConnection connection = new SqlConnection...
My DBAs have informed me that one of my applications is really bogging down one of our LDAP servers. I've looked at the code several times, but I can't see any way to limit the amount of times I have to hit LDAP. So now I've decided to look at the way that I am actually obtaining the data to see if there is a better ...
It looks like you're using the `System.DirectoryServices.Protocols` library to interact with an LDAP server. There can be several reasons why your application may be causing high load on the LDAP server, such as the frequency of requests, the complexity of your LDAP queries, or even how the data is being utilized after...
44,153
[ { "from": "human", "value": "My DBAs have informed me that one of my applications is really bogging down one of our LDAP servers. I've looked at the code several times, but I can't see any way to limit the amount of times I have to hit LDAP. So now I've decided to look at the way that I am actually obtain...
When using divs when is it best to use a class vs id? Is it best to use class, on say font variant or elements within the html? Then use id for the structure/containers? This is something I've always been a little uncertain on, any help would be great.
When deciding whether to use a class or an ID in HTML and CSS, it's essential to understand the key differences between the two and to use them effectively to maintain clean and maintainable code. ### Key Differences: 1. **Uniqueness**: - **ID**: An ID is unique within a document. It can only be assigned to one el...
4,121
[ { "from": "human", "value": "When using divs when is it best to use a class vs id? \nIs it best to use class, on say font variant or elements within the html? Then use id for the structure/containers? \nThis is something I've always been a little uncertain on, any help would be great.\n" }, { "from...
I have a multi-project solution. I believe it is best practice to put all externally referenced assemblies (e.g. OSS stuff) in a folder that is on the relative path of the solution and it's component projects. I'd like to create a real folder called Libs within the same Windows folder that contains my .sln file and ad...
To add a physical folder like "Libs" to your solution in Visual Studio, while also ensuring that it is recognized in source control (Team System in your case), you can follow these steps: ### Step 1: Create the "Libs" Folder 1. **Create the folder**: In Windows Explorer, navigate to the folder where your `.sln` file ...
47,828
[ { "from": "human", "value": "I have a multi-project solution. I believe it is best practice to put all externally referenced assemblies (e.g. OSS stuff) in a folder that is on the relative path of the solution and it's component projects.\nI'd like to create a real folder called Libs within the same Window...
We have a merge replication topology including one publisher, multiple publications and multiple subscriptions. It has been running for at least 8 months without problems. A few days ago I was informed that my PO codes were being "changed" without any reasons, from a standard "ZWWTP/PO-0092" style to a new "ZWWT" style...
It sounds like you're dealing with a complex and frustrating issue with your merge replication setup. Let’s break down the different components of your situation to better understand what's happening and propose some potential steps you can take. ### Analysis of the Issue 1. **Data Discrepancy**: - The change in t...
47,149
[ { "from": "human", "value": "We have a merge replication topology including one publisher, multiple publications and multiple subscriptions. It has been running for at least 8 months without problems.\nA few days ago I was informed that my PO codes were being \"changed\" without any reasons, from a standard...
I am working on a SharePoint application that supports importing multiple documents in a single operation. I also have an ItemAdded event handler that performs some basic maintenance of the item metadata. This event fires for both imported documents and manually created ones. The final piece of the puzzle is a batch...
When dealing with SharePoint and concurrent operations, especially with the `ItemAdded` event handler and batch processes, you can encounter issues like the `COMException 0x81020037`. This typically occurs when there are overlapping modifications on the same SharePoint list item, as you’ve observed. Here are several s...
5,304
[ { "from": "human", "value": "I am working on a SharePoint application that supports importing multiple documents in a single operation. I also have an ItemAdded event handler that performs some basic maintenance of the item metadata. This event fires for both imported documents and manually created ones. ...
Have you used the Application Recovery APIs with vista? http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx Do you find them to be reliable and easy to work with? I am reading through some of the docs and it seems rolling my own might be a better way to go because I can make my solution compatible with XP. H...
Using the Application Recovery APIs in Windows Vista can certainly provide a standardized approach to application recovery, allowing your application to communicate with the operating system regarding its state and recovery options. However, whether or not they are reliable and easy to work with can depend on a few fac...
47,408
[ { "from": "human", "value": "Have you used the Application Recovery APIs with vista? \nhttp://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx\nDo you find them to be reliable and easy to work with? \nI am reading through some of the docs and it seems rolling my own might be a better way to go because ...
Is there a built in way to determine if a component is fully visible in a Flex application (i.e. not offscreen one way or the other). If not how would I go about figurin it out? I want to show or hide additional 'next' and 'previous' buttons if my primary 'next' and 'previous' buttons are off screen. What event would b...
In Adobe Flex, there isn't a built-in method that directly checks if a component is fully visible on screen. However, you can achieve this by determining the bounds of the component and comparing those bounds to the visible area of the application's stage or containing component. Here's a basic approach to figure out ...
45,752
[ { "from": "human", "value": "Is there a built in way to determine if a component is fully visible in a Flex application (i.e. not offscreen one way or the other). If not how would I go about figurin it out?\nI want to show or hide additional 'next' and 'previous' buttons if my primary 'next' and 'previous' ...
After some point wokflows on Sharepoint MOSS 2007 System stopped functioning. They do not start, their status allways remains in 'Starting' state. The issue remains for a declarative workflow. And even if we try to run workflow manually. Issue resolved temporary by restarting owstimer service, but after about 5 minutes...
The issue you are encountering with SharePoint MOSS 2007 workflows remaining in the 'Starting' state is relatively common, especially in environments where workflows are heavily utilized. Here are several troubleshooting steps and considerations that you can follow to identify and potentially resolve the issue: 1. **C...
48,987
[ { "from": "human", "value": "After some point wokflows on Sharepoint MOSS 2007 System stopped functioning. They do not start, their status allways remains in 'Starting' state. The issue remains for a declarative workflow. And even if we try to run workflow manually. Issue resolved temporary by restarting ow...
A colleague and I have spent a few years developing a really cool Matlab application, MDLcompress. Within Matlab, I can type "MDLcompress('filename.txt')" and it will tell me all sorts of really cool stuff about the contents of filename.txt. We'd like to allow other people to use MDLcompress without downloading the c...
Creating a web application to run your MATLAB script involves several steps, including setting up a web server, creating a simple front-end for file upload, and using MATLAB to process the uploaded file. Below is a simplified overview of how you can achieve this using Apache Tomcat and a servlet. ### Step 1: Set Up Y...
45,001
[ { "from": "human", "value": "A colleague and I have spent a few years developing a really cool Matlab application, MDLcompress. Within Matlab, I can type \"MDLcompress('filename.txt')\" and it will tell me all sorts of really cool stuff about the contents of filename.txt. We'd like to allow other people t...
help me to manage IIS (what i am trying to do is create virtual directory, set properties of virtual directory) on a remote PC/Server. and check iis is runnning, and a particular virtual directory exists. iisvdir.vbs helps to manage iis on local system, how can i use it for managing remote systems. or is there any oth...
Managing IIS (Internet Information Services) on a remote server can be accomplished in several ways. Here, I'll provide you with a couple of approaches, including using PowerShell, as well as how to utilize `iisvdir.vbs` for remote management. ### 1. Using PowerShell PowerShell offers a convenient way to manage IIS r...
48,230
[ { "from": "human", "value": "help me to manage IIS (what i am trying to do is create virtual directory, set properties \nof virtual directory) on a remote PC/Server.\nand check iis is runnning, and a particular virtual directory exists.\niisvdir.vbs helps to manage iis on local system, how can i use it for ...
I have colleagues working on a .NET 1.1 project, where they obtain XML files from an external party and programmatically instruct iTextSharp to generate PDF content based on the XML data. The tricky part is, within this XML are segments of arbitrary HTML content. These are HTML code users copied and pasted from their O...
When dealing with HTML content generated from Office applications, the complexity and inconsistency of HTML and CSS can indeed present challenges when using iTextSharp, especially since it has limited support for advanced CSS styling. Here are several alternatives and workarounds you might consider: ### 1. **Use iTex...
48,921
[ { "from": "human", "value": "I have colleagues working on a .NET 1.1 project, where they obtain XML files from an external party and programmatically instruct iTextSharp to generate PDF content based on the XML data.\nThe tricky part is, within this XML are segments of arbitrary HTML content. These are HTML...
This is kind of related to my previous question, but not really. I have an input of which I don't know the culture. So it can both use ',' and '.' as separator for the fraction. The number will never be >5 though, so we can be rather sure if there's a separator, it will be for the fraction. I was looking at the TryPars...
When dealing with number parsing in C#, especially when you're unsure of the culture and the format of decimal separators (i.e., `.` or `,`), you have a few options to manage the variations effectively. The `double.TryParse` method indeed allows you to specify a `NumberStyles`, but it doesn't directly allow you to han...
49,403
[ { "from": "human", "value": "This is kind of related to my previous question, but not really.\nI have an input of which I don't know the culture. So it can both use ',' and '.' as separator for the fraction. The number will never be >5 though, so we can be rather sure if there's a separator, it will be for ...
When designing a ASP.net WebForm application what are some important steps to take (or hacks if you like to use the term) to ensure the best possible performance (in terms of speed, stability, and scalability)?
When designing an ASP.NET WebForms application, several best practices can enhance performance, stability, and scalability. Here are important steps and techniques to consider: ### 1. **Optimize ViewState** - **Minimize ViewState Size**: Only include necessary controls in ViewState by setting `EnableViewState` to `...
42,442
[ { "from": "human", "value": "When designing a ASP.net WebForm application what are some important steps to take (or hacks if you like to use the term) to ensure the best possible performance (in terms of speed, stability, and scalability)?\n" }, { "from": "gpt", "value": "When designing an ASP.N...
Is there a possibility to deactivate / activate all try catch blocks in the whole project as easy as clicking a button? I need this for debugging when I don't want the catch block to handle the exception, but instead prefer that VS breaks into the code as if the try catch block was not there. At the moment I am commen...
In Visual Studio 2008, there isn’t a built-in feature that allows you to globally disable or enable all try-catch blocks with a single click. However, there are a few strategies you can employ to make your debugging process more efficient without needing to manually comment out all your try-catch blocks. ### Strategie...
41,692
[ { "from": "human", "value": "Is there a possibility to deactivate / activate all try catch blocks in the whole project as easy as clicking a button?\nI need this for debugging when I don't want the catch block to handle the exception, but instead prefer that VS breaks into the code as if the try catch block...
I have an ASP.NET website deployed on IIS 6. I have several folders in my app containing handlers like log.ashx, default.ashx and so on. I have default document configured in IIS, so that I can type www.mydomain.com/tools in the browser, and I will get the /tools/default.ashx. IIS gives me 404 all the time, which is my...
The issue you're encountering with IIS 6 not serving your `.ashx` files could be due to a few different configurations. Below are steps to troubleshoot and fix the problem: ### 1. Verify ISAPI Settings Ensure that the ISAPI settings are correctly set up. You have mentioned using `aspnet_isapi.dll` as a wildcard handle...
47,060
[ { "from": "human", "value": "I have an ASP.NET website deployed on IIS 6. I have several folders in my app containing handlers like log.ashx, default.ashx and so on.\nI have default document configured in IIS, so that I can type www.mydomain.com/tools in the browser, and I will get the /tools/default.ashx.\...
I am trying to find a way to get the source code for (user defined) PHP functions in a string. For normal code this is easy, using reflection I can find the file and line numbers where the function is defined; then I can open the file and read the function source code. This will not work if a function is defined in eva...
In PHP, functions defined within `eval` statements cannot be extracted using reflection in the same way as regular functions. The source code of functions defined with `eval` is not preserved in a manner that makes it easily accessible. However, you can try to leverage the `token_get_all()` function in PHP, which token...
46,334
[ { "from": "human", "value": "I am trying to find a way to get the source code for (user defined) PHP functions in a string.\nFor normal code this is easy, using reflection I can find the file and line numbers where the function is defined; then I can open the file and read the function source code.\nThis wi...
Is there any way to split a long string of HTML after N words? Obviously I could use: ' '.join(foo.split(' ')[:n]) to get the first n words of a plain text string, but that might split in the middle of an html tag, and won't produce valid html because it won't close the tags that have been opened. I need to do this in...
To split a long string of HTML after a specified number of words while preserving the validity of the HTML structure, you can use a combination of Python's `BeautifulSoup` library for parsing HTML and some basic string manipulation to count words. Below is a Python function that does exactly that: ```python from bs4 i...
44,586
[ { "from": "human", "value": "Is there any way to split a long string of HTML after N words? Obviously I could use:\n' '.join(foo.split(' ')[:n])\n\nto get the first n words of a plain text string, but that might split in the middle of an html tag, and won't produce valid html because it won't close the tags...
I am working on someone else's PHP code and seeing this pattern over and over: (pseudocode) result = SELECT blah1, blah2, foreign_key FROM foo WHERE key=bar if foreign_key > 0 other_result = SELECT something FROM foo2 WHERE key=foreign_key end The code needs to branch if there is no related row in the other tab...
You're correct in observing that using a `LEFT JOIN` could simplify the code and potentially improve performance by reducing the number of queries executed against the database. Here's a breakdown of the benefits of using `LEFT JOIN` versus multiple separate queries: ### Benefits of Using LEFT JOIN 1. **Fewer Datab...
47,361
[ { "from": "human", "value": "I am working on someone else's PHP code and seeing this pattern over and over:\n(pseudocode)\nresult = SELECT blah1, blah2, foreign_key FROM foo WHERE key=bar\n\nif foreign_key > 0 \n other_result = SELECT something FROM foo2 WHERE key=foreign_key \nend\n\nThe code needs to b...
I just got myself a new toy, a phone with Windows Mobile 6. I'm trying to write a simple "Hello World" app in VS2008 (C#) and I can't connect to the device. It's connected via ActiveSync (via USB), I can browse the file system, but for some reason when I try to build the app and deploy it to the device, it says "Connec...
It can be frustrating when you run into issues connecting to your device from Visual Studio 2008. Here are several steps and checks you can try to resolve the "Connect to device failed" error: ### 1. Check ActiveSync Version Make sure you're using an appropriate version of ActiveSync. For Windows Mobile 6 devices, **W...
49,683
[ { "from": "human", "value": "I just got myself a new toy, a phone with Windows Mobile 6. I'm trying to write a simple \"Hello World\" app in VS2008 (C#) and I can't connect to the device. It's connected via ActiveSync (via USB), I can browse the file system, but for some reason when I try to build the app a...
I'm running into a problem when modifying a WCF service. The original service method looks like this: [OperationContract(IsOneWay = true, IsInitiating = true, IsTerminating = false)] void Login(string userName, string password); This method works. The problem is that when I change it to this: [OperationContract(IsOneW...
The issue you're encountering when changing the WCF service method from a one-way operation to a request-response operation can be due to several factors. Here's a breakdown of potential reasons and considerations to troubleshoot the problem: ### 1. **Timeout Settings** When you change the method to return a value, th...
48,730
[ { "from": "human", "value": "I'm running into a problem when modifying a WCF service.\nThe original service method looks like this:\n[OperationContract(IsOneWay = true, IsInitiating = true, IsTerminating = false)]\nvoid Login(string userName, string password);\n\nThis method works.\nThe problem is that when...
I have a client that want to have a web app I'm building for them display heat maps of the data. I haven't worked with heat maps at all and I was wondering if anyone knew of some good tools for generating them. Thanks.
There are several excellent tools and libraries available for generating heat maps for web applications. Here are some options that you can consider: ### JavaScript Libraries 1. **Leaflet.js**: - A popular open-source JavaScript library for mobile-friendly interactive maps. Leaflet has plugins for heat maps (e.g.,...
44,795
[ { "from": "human", "value": "I have a client that want to have a web app I'm building for them display heat maps of the data.\nI haven't worked with heat maps at all and I was wondering if anyone knew of some good tools for generating them.\nThanks.\n" }, { "from": "gpt", "value": "There are sev...
Let me try to explain what I need. I have a server that is visible from the internet. What I need is to create a ASP.NET application that get the request of a web Site and send to a internal server, then it gets the response and publish the the info. For the client this should be totally transparent. For different reas...
Creating an ASP.NET application that acts as a proxy between an external request and an internal server can be achieved using ASP.NET Core. This kind of setup allows you to accept incoming requests and forward them to an internal server, then return the response to the original client. Here’s a basic outline of how y...
1,982
[ { "from": "human", "value": "Let me try to explain what I need. I have a server that is visible from the internet. What I need is to create a ASP.NET application that get the request of a web Site and send to a internal server, then it gets the response and publish the the info. For the client this should b...
We have a company intranet with staff management functions. I would like to begin automating setup of new staff members, e.g. creating Windows accounts for them, creating their home folders, setting up shares, and the like. When a staff member leaves the company I would like to automatically remove their user. I have b...
To automate user management tasks in a Windows environment using .NET, especially with .NET 2.0, you can use the Active Directory Service Interfaces (ADSI) for user account creation, modification, and deletion. Below are some sample code snippets to help you get started with the common tasks you mentioned. ### 1. Crea...
44,543
[ { "from": "human", "value": "We have a company intranet with staff management functions. I would like to begin automating setup of new staff members, e.g. creating Windows accounts for them, creating their home folders, setting up shares, and the like. When a staff member leaves the company I would like to ...
I've trying to achieve something like this: class Base { public: Base(string S) { ... }; } class Derived: Base { public: int foo; string bar() { return stringof(foo); // actually, something more complex }; Derived(int f) : foo(f), Base(bar()) { }; } Now, this doesn't work as I want, be...
You've identified a common issue when dealing with initialization in C++ classes—specifically, the order of initialization in constructor initialization lists. In your original code, trying to call `bar()` in the constructor initializer list before `foo` has been initialized is indeed problematic because it leads to us...
49,245
[ { "from": "human", "value": "I've trying to achieve something like this:\nclass Base\n{\n public:\n\n Base(string S) \n {\n ...\n };\n}\n\nclass Derived: Base\n{\npublic:\n int foo;\n string bar()\n {\n return stringof(foo); // actually, something more complex\n };\n\n Derived(int f) : foo(f), ...
If you were an asynchronous javascript call in an Asp.Net MVC environment, and you had to work with a round-robin style of load balancer, would you be able to find your way home? edit: adding clarification ..using in-memory session state.
In an ASP.NET MVC environment using a round-robin load balancer and in-memory session state, the situation becomes a bit complex when it comes to maintaining session state across multiple requests. ### Understanding the Scenario: 1. **Round-Robin Load Balancer:** This type of load balancer distributes incoming reques...
48,748
[ { "from": "human", "value": "If you were an asynchronous javascript call in an Asp.Net MVC environment, and you had to work with a round-robin style of load balancer, would you be able to find your way home?\nedit: adding clarification ..using in-memory session state.\n" }, { "from": "gpt", "val...
I have read a lot of popular standards manuals for open source PHP projects. A lot enforce underscores for variables spaces, and a lot enforce camelCase. Should global functions and variables be named differently to class methods/properties? I know the most important thing is consistency, but I'd like to hear some thou...
When developing in PHP or any programming language, naming conventions play a crucial role in maintaining code readability and consistency across a project. Here's a breakdown of considerations for naming global functions, variables, class methods, and properties: ### 1. **Consistency is Key** - Regardless of the s...
48,349
[ { "from": "human", "value": "I have read a lot of popular standards manuals for open source PHP projects.\nA lot enforce underscores for variables spaces, and a lot enforce camelCase.\nShould global functions and variables be named differently to class methods/properties?\nI know the most important thing is...
I have received a content export of a MOSS 2007 site which I need to get replicated in my environment but I am having problems importing it using stsadm. The export was done using stsadm though a command similar to: stsadm -o export -url http://localhost -filename C:\Export I'm using the import command such as: stsa...
When importing a content export in SharePoint MOSS 2007, issues related to role groups can arise if the groups or role definitions from the source environment do not exist in the target environment. Unfortunately, the `stsadm -o import` command does not have a built-in option to ignore role groups or to skip the import...
48,317
[ { "from": "human", "value": "I have received a content export of a MOSS 2007 site which I need to get replicated in my environment but I am having problems importing it using stsadm.\nThe export was done using stsadm though a command similar to:\n\nstsadm -o export -url http://localhost -filename C:\\Export...
My program puts a file into a remote host using HTTP. For some unavoidable reasons, the remote hosts needs some time to acknowledge the final packet of the data transmission. More time than the default timeout, which according to my experience is around 30 seconds. Therefore I wanted to increase the timeout to 5 min...
Setting timeout options for an HTTP connection can sometimes be tricky, especially given that different operating systems or versions of libraries may implement these options differently. Here are some suggestions to troubleshoot and potentially resolve the issue with the timeout settings in your MFC application: ### ...
48,157
[ { "from": "human", "value": "My program puts a file into a remote host using HTTP. For some unavoidable \nreasons, the remote hosts needs some time to acknowledge the final packet of \nthe data transmission. More time than the default timeout, which according \nto my experience is around 30 seconds.\nTheref...
Is there some way I can show custom exception messages as an alert in my jQuery AJAX error message? For example, if I want to throw an exception on the server side via Struts by throw new ApplicationException("User name already exists");, I want to catch this message ('user name already exists') in the jQuery AJAX erro...
To show custom exception messages from your server-side application (like a Struts application) in your jQuery AJAX error callback, you need to ensure that the server is sending the relevant error message in the response body. When an error occurs (like a `500 Internal Server Error`), you can usually send a message bac...
48,946
[ { "from": "human", "value": "Is there some way I can show custom exception messages as an alert in my jQuery AJAX error message?\nFor example, if I want to throw an exception on the server side via Struts by throw new ApplicationException(\"User name already exists\");, I want to catch this message ('user n...
Comparing LinkedLists and Arrays while also comparing their differences with sorted and unsorted data Adding Removing Retrieving Sorting Overall speed Overall memory usage Actual questions Discuss the feasibility of implementing an unsorted data set as a linked list rather than an array. What would the tradeoffs ...
Your input covers several essential points regarding the differences between linked lists and arrays in both unsorted and sorted data contexts. Let’s expand on your thoughts and structure the discussion around the two scenarios: unsorted data and sorted data, and then summarize the tradeoffs. ### 1. **Feasibility of I...
46,559
[ { "from": "human", "value": "Comparing LinkedLists and Arrays while also comparing their differences with sorted and unsorted data\n\nAdding \nRemoving\nRetrieving \nSorting\nOverall speed\nOverall memory usage\n\nActual questions\n\nDiscuss the feasibility of implementing an unsorted data set as a linked l...
I have a 2D image randomly and sparsely scattered with pixels. given a point on the image, I need to find the distance to the closest pixel that is not in the background color (black). What is the fastest way to do this? The only method I could come up with is building a kd-tree for the pixels. but I would really wan...
If you're looking for an efficient way to find the distance to the closest non-background pixel (non-black) from a given point in a sparsely scattered 2D image, and you want to avoid expensive preprocessing like building a kd-tree, you can consider a few alternative approaches: ### 1. **Brute Force Search with Optimiz...
47,874
[ { "from": "human", "value": "I have a 2D image randomly and sparsely scattered with pixels.\ngiven a point on the image, I need to find the distance to the closest pixel that is not in the background color (black).\nWhat is the fastest way to do this? \nThe only method I could come up with is building a kd...
Currently my code is organized in the following tree structure: src/ module1.py module2.py test_module1.py test_module2.py subpackage1/ __init__.py moduleA.py moduleB.py test_moduleA.py test_moduleB.py Where the module*.py files contains the source code and t...
To run all the tests in your project structure using `nosetests`, you can simply point `nosetests` to the directory where your tests are located, which in your case is the `src` directory. You don't need to use the `-m` option if you want to run all tests. Instead, you can execute the following command from the `src` d...
49,513
[ { "from": "human", "value": "Currently my code is organized in the following tree structure:\nsrc/\n module1.py\n module2.py\n test_module1.py\n test_module2.py\n subpackage1/\n __init__.py\n moduleA.py\n moduleB.py\n test_moduleA.py\n test_moduleB.py\n\nWhe...
Possible Duplicate: Is it possible to Pivot data using LINQ? I'm wondering if its at all possible to create crosstab style results with Linq. I have some data that looks like the following: var list = new[] { new {GroupId = 1, Country = "UK", Value = 10}, new {GroupId = 1, Country = "FR", Val...
Creating a crosstab (or pivot table) style output using LINQ can indeed be a bit challenging due to the dynamic nature of the columns. However, you can achieve this by grouping the data and then constructing the output dynamically. Here's a sample implementation of how you can create this crosstab-style output using L...
47,873
[ { "from": "human", "value": "\nPossible Duplicate:\nIs it possible to Pivot data using LINQ? \n\nI'm wondering if its at all possible to create crosstab style results with Linq.\nI have some data that looks like the following:\n var list = new[]\n {\n new {GroupId = 1, Country = \"UK\", Value =...
I'm looking at an existing site and they are using separate databases. The databases seem to be setup in the following manner: general types (user_type, language, age, etc) member data (registration information & login) site configuration Personally, I would put everything into 1 database. To me this would make it ea...
Using separate databases in a web application can be a design choice that is influenced by several factors. Here are some reasons why the existing site might be using separate databases for different types of data: 1. **Modularity**: Separating data into different databases can improve modularity. It allows developers...
39,327
[ { "from": "human", "value": "I'm looking at an existing site and they are using separate databases. The databases seem to be setup in the following manner:\n\ngeneral types (user_type, language, age, etc)\nmember data (registration information & login)\nsite configuration\n\nPersonally, I would put everythi...
I'm quoting part of an answer which I received for another question of mine: In the PHP/MySQL world I would say stored procedures are no-go I would like to know: Is that so? Why? Why not? [edit]I mean this as a general question without a specific need in mind[/edit]
The statement that "stored procedures are a no-go" in the PHP/MySQL world reflects a particular perspective, but it isn't universally applicable. Here are some of the reasons why this sentiment might exist, as well as arguments in favor of using stored procedures: ### Reasons Why Some Might Avoid Stored Procedures in ...
3,469
[ { "from": "human", "value": "I'm quoting part of an answer which I received for another question of mine:\n\nIn the PHP/MySQL world I would say\n stored procedures are no-go\n\nI would like to know: Is that so? Why? Why not?\n[edit]I mean this as a general question without a specific need in mind[/edit]\n"...
I have a WPF ListBox bound to a data object. Inside the listbox are a series of images with text. It is layed out in a horizontal fashion, and mousing over the left or right sides of the box scroll the items left or right respectively. let's say there are 20 items in the listbox. I'm trying to figure out how when I hit...
To implement the cycling behavior in your WPF `ListBox`, you'll need to handle the `MouseMove` event to check the current selected item and update the selection when scrolling occurs. Since your list is horizontal and mousing over the sides triggers scrolling, you'll want to determine the next item based on the current...
49,721
[ { "from": "human", "value": "I have a WPF ListBox bound to a data object. Inside the listbox are a series of images with text. It is layed out in a horizontal fashion, and mousing over the left or right sides of the box scroll the items left or right respectively.\nlet's say there are 20 items in the listbo...
I`m developing an application using Spring WebFlow 2, Facelets and JSF. One of my flows does have a page that must trigger a form submit at certain events. For each different action, a different view must be presented. So, I'm trying to activate the following javascript code to perform the submission: function myFormSu...
To resolve your issue with submitting a form in Spring WebFlow using JavaScript and ensuring the correct transition occurs in your flow, you should consider the following steps: 1. **Ensure the Form is Set Up Correctly**: Verify that the form in your Facelets page is defined properly and that the name is indeed `myFor...
47,796
[ { "from": "human", "value": "I`m developing an application using Spring WebFlow 2, Facelets and JSF. One of my flows does have a page that must trigger a form submit at certain events. For each different action, a different view must be presented. So, I'm trying to activate the following javascript code to ...
Besides "no connection", what other failure modes should I test for? How do I simulate a high-latency link, an unreliable link, or all the other sorts of crazy stuff that will undoubtedly happen "in the wild"? How about wireless applications? How do I test the performance in a less-than-ideal WL environment?
Testing failure modes and simulating adverse network conditions are critical for ensuring the robustness and resilience of applications, especially those that rely on network connectivity. Here are several failure modes to consider, along with techniques for simulating high-latency, unreliable, and other challenging co...
3,071
[ { "from": "human", "value": "Besides \"no connection\", what other failure modes should I test for? How do I simulate a high-latency link, an unreliable link, or all the other sorts of crazy stuff that will undoubtedly happen \"in the wild\"? \nHow about wireless applications? How do I test the performanc...
What are the tensions between multithreading and exception-safety in C++? Are there good guidelines to follow? Does a thread terminate because of an uncaught exception?
In C++, multithreading and exception safety present unique challenges and tensions due to the concurrent nature of threads and the complexity involved in handling exceptions across multiple threads. Here are some key points to consider: ### Tensions Between Multithreading and Exception Safety 1. **Thread Termination*...
41,165
[ { "from": "human", "value": "What are the tensions between multithreading and exception-safety in C++? Are there good guidelines to follow? Does a thread terminate because of an uncaught exception?\n" }, { "from": "gpt", "value": "In C++, multithreading and exception safety present unique challe...
As part of our unit tests, we restore a blank database when the tests start . The unit tests then perform their tests by calling web services (hosted in the Visual Studio ASP.NET host). This works fine for us the first time the unit tests are run, however if they are re-run without restarting the web services, an exce...
To handle the scenario where your application might pick a "bad" connection from the connection pool after a database reset or connection disruption, you can implement some strategies to ensure that the connections are validated before use without significantly impacting the performance of the application. Here are a f...
46,913
[ { "from": "human", "value": "As part of our unit tests, we restore a blank database when the tests start . The unit tests then perform their tests by calling web services (hosted in the Visual Studio ASP.NET host). \nThis works fine for us the first time the unit tests are run, however if they are re-run wi...
I am doing an Financial Winforms application and am having some trouble with the controls. My customer needs to insert decimal values all over the place (Prices, Discounts etc) and I'd like to avoid some of the repeating validation. So I immediately tried the MaskedTextBox that would fit my needs (with a Mask like "€ 0...
You're correct that using the `MaskedTextBox` for currency inputs can be limiting, especially when dealing with variable-length inputs. While it provides a way to enforce a specific format, it can also be restrictive for users who may enter values of different lengths or formats. Here are several alternatives and appro...
42,314
[ { "from": "human", "value": "I am doing an Financial Winforms application and am having some trouble with the controls.\nMy customer needs to insert decimal values all over the place (Prices, Discounts etc) and I'd like to avoid some of the repeating validation.\nSo I immediately tried the MaskedTextBox tha...
I have a rich client application that uses Castle Windsor. At the moment all the assemblies including the application exe are in the one folder but it all looks rather untidy. I would like to put my dlls inside a subfolder such as "bin" but this prevents Castle from locating types etc when called upon. In fact the app ...
Yes, you can configure Castle Windsor to look for your assemblies in a specific directory, such as a "bin" subfolder. By default, Castle Windsor will only scan the current directory for assemblies, so when you move your DLLs to a different directory, it won't find them. You can manually load the assemblies from your s...
44,794
[ { "from": "human", "value": "I have a rich client application that uses Castle Windsor. At the moment all the assemblies including the application exe are in the one folder but it all looks rather untidy. I would like to put my dlls inside a subfolder such as \"bin\" but this prevents Castle from locating t...
We are trying to come up with our client and server standard and there is a big debate. One school of thought is C# client and java servers using some type of proprietary messsage library to share data objects (think XML like structure . .) The issue with this model is that there is lots of code that needs to be dupli...
You've raised a common dilemma when it comes to choosing a technology stack for client-server applications. Here are some considerations that might help clarify your decision: ### Benefits of Using C# on Both Client and Server: 1. **Code Reusability**: By using C# for both the client and server, you can share validat...
48,957
[ { "from": "human", "value": "We are trying to come up with our client and server standard and there is a big debate. One school of thought is C# client and java servers using some type of proprietary messsage library to share data objects (think XML like structure . .)\nThe issue with this model is that th...
Can anybody give me one sample Asp.Net Project where all the Object oriented concept like class, abstraction, polymorphism, Inheritance and array list has been used for my practice purpose. I am new to this platform i know all the above mentioned concept but i don't know where and how to use those concept in web applic...
Certainly! Below is a sample ASP.NET project that demonstrates the use of Object-Oriented Programming (OOP) concepts such as classes, inheritance, polymorphism, abstraction, and collections (like ArrayList). This project is a simple online library management system where you can manage books and users. ### Sample Pro...
41,168
[ { "from": "human", "value": "Can anybody give me one sample Asp.Net Project where all the Object oriented concept like class, abstraction, polymorphism, Inheritance and array list has been used for my practice purpose.\nI am new to this platform i know all the above mentioned concept but i don't know where ...
We get these ~50GB data files consisting of 16 byte codes, and I want to find any code that occurs 1/2% of the time or more. Is there any way I can do that in a single pass over the data? Edit: There are tons of codes - it's possible that every code is different. EPILOGUE: I've selected Darius Bacon as best answer, ...
You're correct in your assessment that finding codes that occur at least 0.5% of the time (or 1/200 of the total) in a single pass is a challenging problem, especially given the constraints you described. Let's break it down. ### Key Concepts 1. **Memory Constraints**: You want to use a minimal amount of memory since...
44,709
[ { "from": "human", "value": "We get these ~50GB data files consisting of 16 byte codes, and I want to find any code that occurs 1/2% of the time or more. Is there any way I can do that in a single pass over the data?\nEdit: There are tons of codes - it's possible that every code is different.\nEPILOGUE: ...
Will everything go to the cloud? If so, in which direction? Google-Gears? Flash,AIR,JavaFX? See also: Does desktop development matter?
The trend toward cloud computing has indeed been significant, with many applications and services transitioning to the cloud for several reasons, including scalability, accessibility, and maintenance. However, whether "everything" will go to the cloud depends on various factors, including use cases, performance require...
46,078
[ { "from": "human", "value": "Will everything go to the cloud? If so, in which direction? Google-Gears? Flash,AIR,JavaFX?\n\nSee also: Does desktop development matter?\n" }, { "from": "gpt", "value": "The trend toward cloud computing has indeed been significant, with many applications and service...
Please note the Edit below for a lot more information, and a possible solution We recently modified a large Delphi application to use ADO connections and queries instead of BDE connections and queries. Since that change, performance has become terrible. I've profiled the application and the bottleneck seems to be at t...
It appears that you've already made some progress in optimizing the performance of your ADO-connected Delphi application by addressing the inefficiencies associated with the `QueryChanged` event. However, if you're still experiencing performance issues, here are several additional strategies you might consider to furth...
46,346
[ { "from": "human", "value": "Please note the Edit below for a lot more information, and a possible solution\nWe recently modified a large Delphi application to use ADO connections and queries instead of BDE connections and queries. Since that change, performance has become terrible.\nI've profiled the appl...