instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I have a generic list... public List<ApprovalEventDto> ApprovalEvents The ApprovalEventDto has public class ApprovalEventDto { public string Event { get; set; } public DateTime EventDate { get; set; } } How do I sort the list by the event date?
To sort a generic list of `ApprovalEventDto` by the `EventDate` property, you can use the `OrderBy` LINQ method from the `System.Linq` namespace. Here’s how you can do it: 1. Make sure you have the `System.Linq` namespace included in your file. 2. Use the `OrderBy` method to sort the list. Here’s an example: ```csha...
25,653
[ { "from": "human", "value": "I have a generic list...\npublic List<ApprovalEventDto> ApprovalEvents\nThe ApprovalEventDto has \npublic class ApprovalEventDto \n{\n public string Event { get; set; }\n public DateTime EventDate { get; set; }\n}\n\nHow do I sort the list by the event date?\n" }, { ...
I want to use an AOP framework, but I have two constraints. Any framework that I choose Must be fairly independent. I plan to use this in a legacy code base, and hence cannot upgrade prospective dependencies like commons-logging-XXX.jar to commons-logging-newest.jar. Must be fairly well documented, should not be too ...
Given your constraints of needing an Aspect-Oriented Programming (AOP) framework that is fairly independent and well-documented, here are a few options you can consider: ### 1. **AspectJ** - **Independence:** AspectJ is a powerful AOP framework that can be used with minimal changes to existing code. You can choose to ...
24,676
[ { "from": "human", "value": "I want to use an AOP framework, but I have two constraints.\nAny framework that I choose\n\nMust be fairly independent. I plan to use this in a legacy code base, and hence \ncannot upgrade prospective dependencies like commons-logging-XXX.jar to commons-logging-newest.jar.\nMust...
Is there a key shortcut for this in XCode? Can I implement an Applescript for this and run it within XCode?
Yes, you can create AppleScript scripts to automate tasks in Xcode, but implementing them directly within Xcode is not straightforward. Here's how to go about it: ### 1. Key Shortcuts in Xcode Xcode does come with a variety of built-in keyboard shortcuts to speed up your workflow. You can find and customize these in ...
21,581
[ { "from": "human", "value": "\nIs there a key shortcut for this in XCode?\nCan I implement an Applescript for this and run it within XCode?\n\n" }, { "from": "gpt", "value": "Yes, you can create AppleScript scripts to automate tasks in Xcode, but implementing them directly within Xcode is not st...
Is there a way to control where Resharper puts its backing fields? currently it tries to put them at the top of the class. Id like them to go right above the property.
Yes, you can control the placement of backing fields in ReSharper. By default, ReSharper may place backing fields at the top of the class, but you can adjust this behavior to place them directly above the properties. Here’s how to configure this: 1. **Open ReSharper Options**: Go to `ReSharper` in the top menu, then s...
26,300
[ { "from": "human", "value": "Is there a way to control where Resharper puts its backing fields? currently it tries to put them at the top of the class. Id like them to go right above the property.\n" }, { "from": "gpt", "value": "Yes, you can control the placement of backing fields in ReSharp...
Which method is preferred? Session.Remove("foo"); Session["foo"] = null; Is there a difference?
Yes, there is a difference between the two methods for removing a session variable in ASP.NET. 1. **`Session.Remove("foo");`** - This method explicitly removes the session variable with the key `"foo"` from the session state. After calling this method, the variable will no longer exist in the session. If you attemp...
27,982
[ { "from": "human", "value": "Which method is preferred?\nSession.Remove(\"foo\");\n\nSession[\"foo\"] = null;\n\nIs there a difference?\n" }, { "from": "gpt", "value": "Yes, there is a difference between the two methods for removing a session variable in ASP.NET.\n\n1. **`Session.Remove(\"foo\")...
I am working with a hosting provider who has installed mod_python for me. I followed the install instructions locally and included it in httpd.conf but they have opted to put it in conf.d/python.conf. Is there any difference/benefit to doing it either way?
When configuring Apache, the difference between including configurations in `httpd.conf` versus using separate files in `conf.d/` (such as `conf.d/python.conf`) primarily relates to organization and maintainability rather than functionality. Here are some key points to consider: ### Organization 1. **Separation of Con...
21,974
[ { "from": "human", "value": "I am working with a hosting provider who has installed mod_python for me. I followed the install instructions locally and included it in httpd.conf but they have opted to put it in conf.d/python.conf.\nIs there any difference/benefit to doing it either way?\n" }, { "fro...
I have this table in an Oracle DB which has a primary key defined on 3 of the data columns. I want to drop the primary key constraint to allow rows with duplicate data for those columns, and create a new column, 'id', to contain an auto-incrementing integer ID for these rows. I know how to create a sequence and trigger...
Yes, it is indeed possible to write a PL/SQL statement that will assign unique IDs to all existing rows in your table. Here is a step-by-step approach to achieve this: 1. **Create a New Column for the ID**: First, you need to add the new `id` column to your table. 2. **Create a Sequence**: Although you mentioned crea...
24,757
[ { "from": "human", "value": "I have this table in an Oracle DB which has a primary key defined on 3 of the data columns. I want to drop the primary key constraint to allow rows with duplicate data for those columns, and create a new column, 'id', to contain an auto-incrementing integer ID for these rows. I ...
Which Template-Engine and Ajax-Framework/-Toolkit is able to load template information from JAR-Files?
When working with Java applications, particularly in web development, you might want to use a template engine and AJAX framework/toolkit that can load templates from JAR files. Here are a few popular options that can fulfill this requirement: ### Template Engines: 1. **Thymeleaf**: - **Description**: Thymeleaf is a...
21,347
[ { "from": "human", "value": "Which Template-Engine and Ajax-Framework/-Toolkit is able to load template information from JAR-Files?\n" }, { "from": "gpt", "value": "When working with Java applications, particularly in web development, you might want to use a template engine and AJAX framework/to...
Is there a catchall function somewhere that works well for sanitizing user input for SQL injection and XSS attacks, while still allowing certain types of HTML tags?
Yes, while there is no one-size-fits-all "catchall" function that perfectly sanitizes user input for both SQL injection and XSS (Cross-Site Scripting) attacks while allowing certain types of HTML tags, you can achieve this with a combination of best practices and libraries. Here are some recommendations: ### SQL Injec...
23,297
[ { "from": "human", "value": "Is there a catchall function somewhere that works well for sanitizing user input for SQL injection and XSS attacks, while still allowing certain types of HTML tags?\n" }, { "from": "gpt", "value": "Yes, while there is no one-size-fits-all \"catchall\" function that p...
We are implementing an IP based geolocation service, and we need to find some IP's from various markets (LA, NY etc) to fully test the service. Does anybody know of a directory where we could find what IP ranges are used where? EDIT: We have already implemented the system, it uses a 3rd party DB and a webservice. We ju...
If you are looking to test your IP-based geolocation service with specific IP addresses from various markets, there are several resources and strategies you can use: 1. **MaxMind GeoLite2 Database**: As you mentioned, MaxMind offers a free GeoLite2 database, which provides geolocation data for IP addresses. You can do...
25,142
[ { "from": "human", "value": "We are implementing an IP based geolocation service, and we need to find some IP's from various markets (LA, NY etc) to fully test the service.\nDoes anybody know of a directory where we could find what IP ranges are used where?\nEDIT: We have already implemented the system, it ...
In C and C++ you can tell the compiler that a number is a 'long' by putting an 'l' at the end of the number. e.g long x = 0l; How can I tell the C# compiler that a number is a byte?
In C#, you can specify that a numeric literal should be treated as a `byte` by using a cast or by using the `byte` type explicitly. Unlike C and C++, there isn't a suffix for byte literals in C#. Here are a couple of ways to assign a literal value to a byte variable: ### Using a Cast You can use casting to convert a n...
27,377
[ { "from": "human", "value": "In C and C++ you can tell the compiler that a number is a 'long' by putting an 'l' at the end of the number.\ne.g long x = 0l;\nHow can I tell the C# compiler that a number is a byte?\n" }, { "from": "gpt", "value": "In C#, you can specify that a numeric literal shou...
How can I break SP execution in an Exception like fashion in MySQL? I need a to break SP execution when an illegal argument is passed so no UPDATE/INSERT is performed. My teacher actually did it by creating an SP called "raise_error" which did nothing but execute a non extising table. Which I would argue is a WTF...
In MySQL, you can handle exceptions and control the flow of stored procedure (SP) execution using the `SIGNAL` statement. This allows you to raise an error and terminate the execution of the stored procedure without having to resort to workarounds like calling non-existing tables. Here's a simple way to raise an error...
25,224
[ { "from": "human", "value": "How can I break SP execution in an Exception like fashion in MySQL?\nI need a to break SP execution when an illegal argument is passed so no UPDATE/INSERT is performed.\nMy teacher actually did it by creating an SP called \"raise_error\" which did nothing but execute a non extis...
I changed the folder that my WordPress installation was in. However, this worked fine, except now all my images are not showing up. The problem is that each post has the full url of the image in it. (not my doing, this seems to be the default setting) Is there a tool or a quick fix available for this?
When you move a WordPress installation to a new folder or domain, the URLs for your images, which are stored in the database, may no longer point to the correct location. Here are several methods to fix this issue: ### Method 1: Update URLs in Database with a Plugin 1. **Install a Search & Replace Plugin**: You can us...
22,810
[ { "from": "human", "value": "I changed the folder that my WordPress installation was in.\nHowever, this worked fine, except now all my images are not showing up.\nThe problem is that each post has the full url of the image in it. (not my doing, this seems to be the default setting)\nIs there a tool or a qui...
After asking this question I was advised not to check in binaries into subversion. My question is then what do I do with 3rd party dlls that are required to be in the bin folder? I need to be able checkout a working copy and have that run as a website with all dlls, etc intact.
When working with third-party DLLs in a Subversion (SVN) repository, it's common practice to avoid checking in binaries whenever possible due to the overhead of managing binary files in version control. However, if these DLLs are necessary for your project to run (such as in the case of a web application), here are sev...
22,161
[ { "from": "human", "value": "After asking this question I was advised not to check in binaries into subversion. My question is then what do I do with 3rd party dlls that are required to be in the bin folder? I need to be able checkout a working copy and have that run as a website with all dlls, etc intact.\...
What is the latest version of the Boost library that is compatible with Microsoft Visual C++ 6? And can you provide a link to download it directly? The Downloads link at http://www.boost.org only gives a download for version 1.36.0, and the documentation for that version lists Visual C++ 7.1 as the lowest version of M...
Boost libraries have evolved significantly over the years, and compatibility with older compilers like Microsoft Visual C++ 6 is quite limited. The last version of the Boost library that is known to be compatible with Microsoft Visual C++ 6 is **Boost 1.33.1**. While newer versions of Boost have dropped support for su...
26,256
[ { "from": "human", "value": "What is the latest version of the Boost library that is compatible with Microsoft Visual C++ 6? And can you provide a link to download it directly?\nThe Downloads link at http://www.boost.org only gives a download for version 1.36.0, and the documentation for that version lists...
In C# there is the static property Environment.Newline that changed depending on the running platform. Is there anything similar in Java?
Yes, in Java, you can use `System.lineSeparator()` to get the system-dependent line separator string. This method returns a string that represents the line separator for the operating system on which the Java Virtual Machine is running. It serves a similar purpose to `Environment.NewLine` in C#. Here's an example of h...
29,007
[ { "from": "human", "value": "In C# there is the static property Environment.Newline that changed depending on the running platform.\nIs there anything similar in Java?\n" }, { "from": "gpt", "value": "Yes, in Java, you can use `System.lineSeparator()` to get the system-dependent line separator s...
We have a large C/C++ legacy source tree that has been around the block a few times. We expect there are a substantial number of methods no longer used. Is there a tool that can help us quickly identify the unused code?
Yes, there are several tools and techniques you can use to identify unused code in a large C/C++ legacy source tree. Here are some options: 1. **Static Code Analysis Tools**: Tools like **Cppcheck** and **Clang Static Analyzer** can help identify unused functions and variables by performing static analysis on your cod...
25,646
[ { "from": "human", "value": "We have a large C/C++ legacy source tree that has been around the block a few times. We expect there are a substantial number of methods no longer used. Is there a tool that can help us quickly identify the unused code?\n" }, { "from": "gpt", "value": "Yes, there a...
I maintain several old MFC applications using Visual Studio 7 and I was considering upgrading to Visual Studio 2008. After reading this question, I realise that the Express edition will not be able to do this. Does anyone know if I will be able to compile old MFC apps with VS2008 Standard edition or will I need to get ...
You will be able to compile old MFC applications using Visual Studio 2008 Standard Edition. The Standard Edition supports MFC development, so you won't need to purchase the more expensive Professional Edition for that purpose. Just ensure that you install the required components during the setup process to enable MFC s...
29,820
[ { "from": "human", "value": "I maintain several old MFC applications using Visual Studio 7 and I was considering upgrading to Visual Studio 2008. After reading this question, I realise that the Express edition will not be able to do this.\nDoes anyone know if I will be able to compile old MFC apps with VS20...
I have access to an Oracle server that has some databases that I would like to access. However, the machine that I have access from has none of the oracle client software. Is there any alternative to oracle's client software the provides the functionality of something like MySQL's mysql or Postgres' psql? I'd like to b...
Yes, there are several alternatives to Oracle's client software that you can use to access an Oracle database without needing to install the full Oracle client. Here are a few options: 1. **SQL*Plus via Instant Client**: Oracle provides a lightweight Instant Client that you can download and run without a full installa...
24,005
[ { "from": "human", "value": "I have access to an Oracle server that has some databases that I would like to access. However, the machine that I have access from has none of the oracle client software. Is there any alternative to oracle's client software the provides the functionality of something like MySQL...
Some rows in the dataset visualizer have an exclamation mark for each column, other rows have the data as expected. I have been unable to track down a description for the exclamation mark or indeed any symbol within the dataset visualizer. What does the VisualStudio Dataset visualizer exclaimation mark mean?
In the Visual Studio Dataset Visualizer, an exclamation mark typically indicates that there is an issue or warning with the data being displayed in that particular row or column. This could mean several things, such as: 1. **Null or Missing Values**: The exclamation mark may indicate that there are null values or miss...
27,558
[ { "from": "human", "value": "Some rows in the dataset visualizer have an exclamation mark for each column, other rows have the data as expected. I have been unable to track down a description for the exclamation mark or indeed any symbol within the dataset visualizer.\nWhat does the VisualStudio Dataset vis...
In light of how ajax is actually used by most sites today; why is ajax embraced while frames are still regarded as a bad idea?
AJAX (Asynchronous JavaScript and XML) and frames serve different purposes and have different implications for user experience, performance, and usability. Here's why AJAX is embraced while frames are generally regarded as a bad idea: ### AJAX Advantages: 1. **Asynchronous Updates**: AJAX allows web applications to s...
23,970
[ { "from": "human", "value": "In light of how ajax is actually used by most sites today; why is ajax embraced while frames are still regarded as a bad idea?\n" }, { "from": "gpt", "value": "AJAX (Asynchronous JavaScript and XML) and frames serve different purposes and have different implications ...
The code at the end produces a compile error: NotApplicable.java:7: run() in cannot be applied to (int) run(42); ^ 1 error The question is why? Why does javac think I am calling run(), and does not find run(int bar)? It correctly called foo(int bar). Why do I have to use NotApplicab...
The compile error you are encountering is due to the way Java handles method resolution in the context of inner classes and the scope of the surrounding class. In your code, you have an anonymous inner class implementing the `Runnable` interface. When you call `run(42);` inside the `run()` method of the anonymous inne...
25,946
[ { "from": "human", "value": "The code at the end produces a compile error:\nNotApplicable.java:7: run() in cannot be applied to (int)\n run(42);\n ^\n1 error\n\nThe question is why? Why does javac think I am calling run(), and does not find run(int bar)? It correctly called ...
does anybody know how to refresh the Internet Explorer (like by pressingthe F5 key) but using some "backdoor" like PostMessage or SendMessage? The internet Explorer Window is not active so I can't use the keyboard. Thanks (Language doesnt matter)
You can simulate the F5 key press in Internet Explorer using the Windows API to send a message to the Internet Explorer window. This can be done using programming languages that support Windows API calls, such as C# or Python. Below are examples in both languages. ### C# Example You can use the `SendMessage` function...
23,219
[ { "from": "human", "value": "does anybody know how to refresh the Internet Explorer (like by pressingthe F5 key) but using some \"backdoor\" like PostMessage or SendMessage? The internet Explorer Window is not active so I can't use the keyboard.\nThanks\n(Language doesnt matter)\n" }, { "from": "gpt...
I am trying to rename all the files present in a Windows directory using FOR command as follows at the command prompt: for %1 in (*.*) do ren %1 test%1 E.g. This renames a file enc1.ctl to testenc1.ctl enc2.ctl to testenc2.ctl Thats not what i want. What i want is enc1.ctl renamed to test1.ctl enc2.ctl renamed to ...
To rename files in a Windows directory sequentially as you described (e.g., `h263_enc_random_pixels_1.ctl` to `test1.ctl`), you can use a batch script with a counter. The `FOR` command alone will not manage counters easily, but a loop with a variable will help. Here is a script that should do what you're looking for: ...
21,621
[ { "from": "human", "value": "I am trying to rename all the files present in a Windows directory using FOR command as follows at the command prompt:\nfor %1 in (*.*) do ren %1 test%1 \n\nE.g. This renames a file enc1.ctl to testenc1.ctl enc2.ctl to testenc2.ctl \nThats not what i want. What i want is \nenc1...
Currently I have: <system.net> <mailSettings> <smtp from="me@mydomain.com"> <network host="localhost" port="25" /> </smtp> </mailSettings> </system.net> How can I change it so the email is sent with a name and not the email address only?
To include a display name along with the email address in your SMTP configuration, you will need to modify the `from` attribute in the `<smtp>` section. Instead of just specifying the email address, you can use the following format: ``` "Display Name" <email@domain.com> ``` Here’s how you can change your configuratio...
26,150
[ { "from": "human", "value": "Currently I have:\n<system.net>\n <mailSettings>\n <smtp from=\"me@mydomain.com\">\n <network \n host=\"localhost\" \n port=\"25\"\n />\n </smtp>\n </mailSettings>\n </system.net>\n\nHow can I change it so the email is se...
What do you do to pass information between forms? Forward is straight forward (sorry) using Properties or maybe parameters in a New() or DoStuff() method, but what about sending something back when the user is done with the second form? (IE. ID of the item selected) We have used all these: Passed the calling form in...
Passing information between forms can be a common challenge in application design, particularly as you start to think about decoupling and maintaining a clean architecture. You already mentioned some common approaches, and you're correct in your analysis of their pros and cons. When dealing with forms in different DLLs...
21,311
[ { "from": "human", "value": "What do you do to pass information between forms? Forward is straight forward (sorry) using Properties or maybe parameters in a New() or DoStuff() method, but what about sending something back when the user is done with the second form? (IE. ID of the item selected) We have us...
First of all, using gnome is not an option (but it is possible to install its libraries). I need to know what is necessary to display a Java Swing desktop application using the current installed KDE look and feel of KDE. Ideally, the solution should allow me to apply a look and feel that looks like the underlying windo...
To achieve a native look and feel for your Java Swing application under KDE while using GTK, there are a few steps and considerations to keep in mind. Here’s a breakdown based on the issues you’ve described: ### 1. Environment Setup Make sure you have the necessary GTK libraries installed on your Debian system with KD...
21,785
[ { "from": "human", "value": "First of all, using gnome is not an option (but it is possible to install its libraries).\nI need to know what is necessary to display a Java Swing desktop application using the current installed KDE look and feel of KDE. Ideally, the solution should allow me to apply a look and...
I'm putting together a script to find remove duplicates in a large library of images. At the moment I'm doing a two pass filter of first finding files of the same size and then doing a sha256 on a 10240 byte piece of the file to get a fingerprint of the files with the same size (code here). It works well, but I'm guess...
JPEG files do not have a built-in checksum in the traditional sense, but they do contain some metadata that can be used to help identify duplicates more efficiently. Here are some options you could consider: ### 1. **Image Metadata (EXIF)** Many JPEG files contain EXIF (Exchangeable Image File Format) metadata, which...
21,950
[ { "from": "human", "value": "I'm putting together a script to find remove duplicates in a large library of images. At the moment I'm doing a two pass filter of first finding files of the same size and then doing a sha256 on a 10240 byte piece of the file to get a fingerprint of the files with the same size ...
I have a GridView control that I am dynamically creating at runtime. I am creating all the columns like this. foreach (GridColumnConfig column in columns) { BoundField boundField = new BoundField(); boundField.HeaderText = column.Title; boundField.DataField = column.FieldName; boundField.SortExpression ...
Controlling the widths and text wrapping in a GridView can be a bit tricky, especially when dealing with different browsers like Internet Explorer 6 and Firefox. Here are some tips to ensure that your GridView columns behave more consistently across browsers: 1. **Set the Width in CSS**: While you are setting the widt...
25,743
[ { "from": "human", "value": "I have a GridView control that I am dynamically creating at runtime. I am creating all the columns like this.\nforeach (GridColumnConfig column in columns)\n{\n BoundField boundField = new BoundField();\n boundField.HeaderText = column.Title;\n boundField.DataField = co...
I'm not sure how to look for this online... I think they might be called something different in C++ I want to have a simple event system, somthing like event myCustomEvent; myCustomEvent.subscribe( void myHandler(string) ); myCustomEvent.fire("a custom argument"); // myHandler prints out the string passed in the first ...
Your question is definitely not stupid! What you're describing is a common need in programming, and it's great that you're exploring event systems and the observer pattern. C++ doesn't have built-in event handling like some other languages, but you can implement a flexible event system yourself, or use existing librari...
25,598
[ { "from": "human", "value": "I'm not sure how to look for this online... I think they might be called something different in C++\nI want to have a simple event system, somthing like\nevent myCustomEvent;\nmyCustomEvent.subscribe( void myHandler(string) );\nmyCustomEvent.fire(\"a custom argument\");\n// myHa...
There are some cool and exciting features in .NET 3.5/C# 3.0, and with those features comes some darn interesting ways to write the exact same line of code. Using the above stated tool set (and by extension .NET 2.0 stuff), what are the different ways the below code snippet could reasonably be rewritten? strin...
The code snippet you provided can be rewritten in several different ways using features available in .NET 3.5 and C# 3.0. Below are several variations of your original code that leverage features like LINQ, lambda expressions, and inline variable declaration. ### 1. Using LINQ This version uses LINQ to make the code ...
21,844
[ { "from": "human", "value": "There are some cool and exciting features in .NET 3.5/C# 3.0, and with those features comes some darn interesting ways to write the exact same line of code.\nUsing the above stated tool set (and by extension .NET 2.0 stuff), what are the different ways the below code snippet cou...
Is it possible to assign a custom ID to a HTTP session through Servlet API? I know that session handling from any application server, Tomcat for example, it's enough good to generate unique IDs. But I have custom unique session IDs based on information per user and time, so it won't be repeated. And I looked at every d...
In the Java Servlet API, the `HttpSession` object is typically generated by the servlet container (like Tomcat) when a new session is created. This container also generates a unique session ID for the session, which is accessible via the `getId()` method of the `HttpSession` interface. However, the API does not provide...
23,216
[ { "from": "human", "value": "Is it possible to assign a custom ID to a HTTP session through Servlet API?\nI know that session handling from any application server, Tomcat for example, it's enough good to generate unique IDs. But I have custom unique session IDs based on information per user and time, so it ...
How to Programmatically Inject JavaScript in PDF files? Can it be done without Adobe Professional? My goal is: I want to show up the print dialog immediately when I open the PDF. I know that this can be done with JavaScript code embedded in the document.
Injecting JavaScript into PDF files programmatically is a task that requires a good understanding of PDF file structures and the libraries available for PDF manipulation. While Adobe Acrobat Professional is one of the most popular tools for this, you can achieve this using various programming libraries that handle PDF ...
22,345
[ { "from": "human", "value": "How to Programmatically Inject JavaScript in PDF files?\nCan it be done without Adobe Professional?\n\nMy goal is: I want to show up the print dialog immediately when I open the PDF. \nI know that this can be done with JavaScript code embedded in the document.\n" }, { "f...
We currently have a whole suite of report designs that cover various parts of our app, and these reports are generated on demand by our users. I want to be able to bundle up several of these reports into a single report to return to the user. I initially hacked up a custom report builder that generated report design fi...
To create a more streamlined process for bundling reports without duplicating effort, consider implementing a modular approach that allows you to reference existing report designs without needing to copy them into a library file. Here’s a structured plan to achieve that: ### 1. Modular Report Design **Design Concept:...
22,368
[ { "from": "human", "value": "We currently have a whole suite of report designs that cover various parts of our app, and these reports are generated on demand by our users.\nI want to be able to bundle up several of these reports into a single report to return to the user.\nI initially hacked up a custom rep...
As a software developer, I have done many web page applications and been doing blog for my programming experiences. I would like to use pictures in many cases. Pictures worth thousand words and they are universal language! You could create your own clip art images or download graphics(actually many are open clip art/im...
Yes, there are several websites that provide access to a vast array of images and clipart that can be used in web development projects without the need for downloading and uploading files. Here are some popular options: 1. **Unsplash**: Unsplash offers a large collection of high-resolution photos that are free to use....
23,586
[ { "from": "human", "value": "As a software developer, I have done many web page applications and been doing blog for my programming experiences. I would like to use pictures in many cases. Pictures worth thousand words and they are universal language!\nYou could create your own clip art images or download g...
Anyone know of a link to a good article/tutorial for getting started using jQuery for AJAX calls rather than ASP.NET AJAX? I'm trying to avoid using UpdatePanels entirely in this app, which I haven't been able to accomplish in the past.
Certainly! jQuery is a great choice for making AJAX calls as it simplifies the process of sending and receiving data asynchronously. Here are a few resources and a brief tutorial to help you get started with jQuery for AJAX calls: ### Resources 1. **jQuery AJAX Documentation**: - Official jQuery Documentation: [jQ...
19,145
[ { "from": "human", "value": "Anyone know of a link to a good article/tutorial for getting started using jQuery for AJAX calls rather than ASP.NET AJAX? I'm trying to avoid using UpdatePanels entirely in this app, which I haven't been able to accomplish in the past.\n" }, { "from": "gpt", "value"...
The website works with Wemf and Google Analytics, but they are giving me very different results; WEMF counts 10 - 30 % more page views than Google Analytics... Why can this be? Google Analytics works only with JavaScript enabled, yes - but I don't think that's the reason for this difference. The site which should be co...
It's not uncommon to see discrepancies between different web analytics platforms, and there are several reasons why WEMF and Google Analytics might show different numbers of page views. Here are some possible explanations for the 10-30% variance you’re experiencing: 1. **Tracking Methodologies**: - **JavaScript Dep...
20,154
[ { "from": "human", "value": "The website works with Wemf and Google Analytics, but they are giving me very different results; WEMF counts 10 - 30 % more page views than Google Analytics... Why can this be?\nGoogle Analytics works only with JavaScript enabled, yes - but I don't think that's the reason for th...
I know that cursors are frowned upon and I try to avoid their use as much as possible, but there may be some legitimate reasons to use them. I have one and I am trying to use a pair of cursors: one for the primary table and one for the secondary table. The primary table cursor iterates through the primary table in an o...
The issue you're facing is due to the way the `curScores` cursor is defined. When you declare the cursor for the secondary table, it captures the value of `@Fname` at that moment. After that, when you use `@Fname` in the `WHERE` clause of `curScores`, it will not be updated with each iteration of the outer loop because...
24,878
[ { "from": "human", "value": "I know that cursors are frowned upon and I try to avoid their use as much as possible, but there may be some legitimate reasons to use them. I have one and I am trying to use a pair of cursors: one for the primary table and one for the secondary table. The primary table cursor i...
I have a complex .NET Remoting server app that provides a couple of services. Clients can currently use tcp and http channels to connect to the server. Now I need to implement some new administration services, but I want to restrict their availability to the local machine, i.e. I want to create an administration tool t...
In .NET Remoting, there isn't a built-in mechanism to specify that certain services should only be available via IPC while others are available via TCP or HTTP in the configuration file or when registering services. However, you can implement a solution that achieves your goal by doing the following: ### 1. Create a S...
23,447
[ { "from": "human", "value": "I have a complex .NET Remoting server app that provides a couple of services. Clients can currently use tcp and http channels to connect to the server.\nNow I need to implement some new administration services, but I want to restrict their availability to the local machine, i.e....
I have a table of "items", and a table of "itemkeywords". When a user searches for a keyword, I want to give him one page of results plus the total number of results. What I'm doing currently is (for a user that searches "a b c": SELECT DISTINCT {fields I want} FROM itemkeywords JOIN items WHERE (keyword = 'a'...
Your current approach of executing two separate queries—one for retrieving results with a limit and one for counting total results—can be optimized. Here are a few strategies you can consider to reduce the number of queries and improve efficiency. ### 1. Use a Subquery to Count Results Instead of running two separate...
11,697
[ { "from": "human", "value": "I have a table of \"items\", and a table of \"itemkeywords\".\nWhen a user searches for a keyword, I want to give him one page of results plus the total number of results.\nWhat I'm doing currently is (for a user that searches \"a b c\": \nSELECT DISTINCT {fields I want} FROM i...
For those not familiar with Core Image, here's a good description of it: http://developer.apple.com/macosx/coreimage.html Is there something equivalent to Apple's CoreImage/CoreVideo for Windows? I looked around and found the DirectX/Direct3D stuff, which has all the underlying pieces, but there doesn't appear to be an...
If you're looking for a high-level equivalent to Apple's Core Image and Core Video for Windows, there are several options that you might consider: 1. **Direct2D**: This is part of the DirectX family and provides a high-performance, immediate-mode 2D graphics API that makes it easier to render images, text, and other g...
23,798
[ { "from": "human", "value": "For those not familiar with Core Image, here's a good description of it:\nhttp://developer.apple.com/macosx/coreimage.html\nIs there something equivalent to Apple's CoreImage/CoreVideo for Windows? I looked around and found the DirectX/Direct3D stuff, which has all the underlyin...
How does one import CSV files via Excel VBA in a set, in groups or in multiple individual files, rather than one at a time?
To import multiple CSV files using Excel VBA, you can create a macro that loops through a specified folder and imports all CSV files at once. Here's a step-by-step guide and sample code to help you achieve this: ### Step 1: Open the Visual Basic for Applications (VBA) Editor 1. Open Excel. 2. Press `ALT + F11` to ope...
22,556
[ { "from": "human", "value": "How does one import CSV files via Excel VBA in a set, in groups or in multiple individual files, rather than one at a time?\n" }, { "from": "gpt", "value": "To import multiple CSV files using Excel VBA, you can create a macro that loops through a specified folder and...
I have a collection of ClickOnce packages in a publish folder on a network drive and need to move them all to another server (our DR machine). After copy/pasting the whole directory and running the setups on the new machine I get an error message stating that it cannot find the old path: Activation of ...MyClickOn...
When moving ClickOnce packages from one server to another, there are several important steps you need to follow to ensure that everything works properly. The errors you're encountering suggest that the ClickOnce manifests are still pointing to the old deployment URL and that the signatures are invalid because they don'...
19,255
[ { "from": "human", "value": "I have a collection of ClickOnce packages in a publish folder on a network drive and need to move them all to another server (our DR machine). \nAfter copy/pasting the whole directory and running the setups on the new machine I get an error message stating that it cannot find t...
I've been using various source control systems for a while, but when it comes to reverting changes I'm not yet an expert. Can someone help given this scenario: Scenario Given a bug was introduced in revision #5 And 3 files were changed in revision #5 And changes in 2 files were responsible for the bug When the custome...
Certainly! Here's how you can revert changes and apply the necessary patches based on the scenario you described. The exact commands can vary based on the version control system you're using. Below, I'll provide instructions for both Git and a generic example for other systems that might use patch files. ### Using Git...
22,729
[ { "from": "human", "value": "I've been using various source control systems for a while, but when it comes to reverting changes I'm not yet an expert. Can someone help given this scenario:\nScenario\n\nGiven a bug was introduced in revision #5\nAnd 3 files were changed in revision #5\nAnd changes in 2 files...
I have two machines... a development machine and a production machine. When I first brought my rails app onto the production server, I had no problem. I simply imported schema.rb by running rake db:schema:load RAILS_ENV=production. All was well. So, then on my development machine, I made some more changes and anothe...
The issue you're encountering is due to the fact that your `schema_migrations` table in the production database is not in sync with the migrations available in your application. The migration you added in development has not been executed on the production database, and because of that, the corresponding version number...
23,494
[ { "from": "human", "value": "I have two machines... a development machine and a production machine. When I first brought my rails app onto the production server, I had no problem. I simply imported schema.rb by running rake db:schema:load RAILS_ENV=production. All was well.\nSo, then on my development ma...
I am developing a little app that retrieves an XML file, located on a remote server (http://example.com/myfile.xml) This file is relatively big, and it contains a big list of geolocations with other information that I need to use for my app. So I read this file remotely once and insert it into a little SqlCE file (data...
Certainly! There are various approaches you can take to handle large XML files with geolocation data. Let's break down your options: 1. **Using a Local Database**: - **SQL Database (like SQLite)**: While you mentioned wanting to avoid using .sdf files, consider using a lightweight database like SQLite. It's highly ...
25,379
[ { "from": "human", "value": "I am developing a little app that retrieves an XML file, located on a remote server (http://example.com/myfile.xml)\nThis file is relatively big, and it contains a big list of geolocations with other information that I need to use for my app.\nSo I read this file remotely once a...
I have a Delphi DLL with a function defined as: function SubmitJobStringList(joblist: tStringList; var jobno: Integer): Integer; I am calling this from C#. How do I declare the first parameter as a tStringList does not exist in C#. I currently have the declaration as: [DllImport("opt7bja.dll", CharSet = CharSet.Ansi, C...
To properly call the Delphi function `SubmitJobStringList` from C#, you'll need to mimic the `TStringList` structure in a way that Delphi can understand. Since `TStringList` is essentially a list of strings in Delphi, we need to represent it in C# as a compatible structure. Here's how to approach it: ### Step 1: Defi...
21,896
[ { "from": "human", "value": "I have a Delphi DLL with a function defined as:\nfunction SubmitJobStringList(joblist: tStringList; var jobno: Integer): Integer;\nI am calling this from C#. How do I declare the first parameter as a tStringList does not exist in C#. I currently have the declaration as:\n[DllImp...
So I have an Access database with a front and a back end. I will be distributing it to users soon, but I have no control over where exactly they will put the files on their computers. However, I think I can count on them putting front and back ends in the same folder. As such, when the front end opens, I want it to c...
To check the linked tables and ensure that they are correctly connected to the back-end database before any forms are opened in your Access front-end, you should use the `Form_Open` event of the start-up form. However, if you want to make sure that no forms are opened yet, you might want to use the `AutoExec` macro to ...
24,674
[ { "from": "human", "value": "So I have an Access database with a front and a back end. I will be distributing it to users soon, but I have no control over where exactly they will put the files on their computers. However, I think I can count on them putting front and back ends in the same folder.\nAs such...
I'm trying to get my head around the Error Handling in MVC. What I'm looking for is a centralized way to catch errors, log them, if possible resolve them, if nessecary take other actions and finally show the correct view to the user. I think I can use the [HandleError] filter for this, but I don't see any way to route ...
Error handling in ASP.NET MVC can indeed be centralized and streamlined using various techniques. While the `[HandleError]` attribute is a good start for basic error handling, it has some limitations, particularly when it comes to redirecting to a specific controller/action. Below, I’ll outline a few approaches to hand...
19,976
[ { "from": "human", "value": "I'm trying to get my head around the Error Handling in MVC.\nWhat I'm looking for is a centralized way to catch errors, log them, if possible resolve them, if nessecary take other actions and finally show the correct view to the user.\nI think I can use the [HandleError] filter ...
I'm trying to build a similar 'slider' as demoed here http://ui.jquery.com/repository/real-world/product-slider/ but I'm trying to use interior divs inside of the list items (<li>). it seems as if this demo breaks if you're not using an image or block element (<p>,<div>,etc.) Anyone have any quick solutions to this? ...
If you're looking to create a slider similar to the jQuery UI demo but want to use `<div>` elements (containing text and images) inside your `<li>` items, you can achieve this using a simple jQuery solution with CSS styling. Below is an example of how you can set it up: ### HTML Structure ```html <!DOCTYPE html> <htm...
22,006
[ { "from": "human", "value": "I'm trying to build a similar 'slider' as demoed here http://ui.jquery.com/repository/real-world/product-slider/ but I'm trying to use interior divs inside of the list items (<li>). it seems as if this demo breaks if you're not using an image or block element (<p>,<div>,etc.)\n...
I was delivered several hundred source files for a web app original written in classic ASP, but somewhat ported to VisualBasic.NET and ASP.NET It didn't come with any form of project or solution files. I'm trying to get it setup to build, but am struggling. If I try to open it as a WebSite (ala Web Site instead of Web ...
Converting a collection of files from a web application that was originally written in Classic ASP, then partially migrated to VB.NET and ASP.NET, can be a challenging task, especially without a structured project setup. Here’s a step-by-step approach you might take to try to resolve the issues and set up the project f...
17,010
[ { "from": "human", "value": "I was delivered several hundred source files for a web app original written in classic ASP, but somewhat ported to VisualBasic.NET and ASP.NET\nIt didn't come with any form of project or solution files.\nI'm trying to get it setup to build, but am struggling. If I try to open it...
I'm using the sortable function in jquery to sequence a faq list. Needless to say, i'm new to this concept. Anybody have any good examples of the backend for this. I have the front working fine, but updating the sequence in the database is another story. My backend is ColdFusion btw. Thanks in advance
To implement a sortable FAQ list with jQuery and ColdFusion, you will need to set up both your front-end and back-end to handle the drag-and-drop functionality and the updating of the sequence in your database. ### Front-End (HTML + jQuery) 1. **Create your FAQ list in HTML:** ```html <ul id="faq-list"> <li data...
21,096
[ { "from": "human", "value": "I'm using the sortable function in jquery to sequence a faq list. Needless to say, i'm new to this concept. Anybody have any good examples of the backend for this. I have the front working fine, but updating the sequence in the database is another story. My backend is ColdFus...
I've searched around a bit, but haven't found a satisfactory answer, so I'd like to hear your opinions on this. I have a couple of tools which I have to update and deploy to a few servers every now and then. The source is managed in a SVN repository. To save myself the bother of copying the binaries to the production s...
Your idea of organizing your SVN repository to manage source code and binaries is quite reasonable, and it reflects a common challenge when working with version control systems. Here's a breakdown of your approach and some suggestions to enhance it: ### Your Approach 1. **Separate Directory for Binaries**: Creating a ...
21,422
[ { "from": "human", "value": "I've searched around a bit, but haven't found a satisfactory answer, so I'd like to hear your opinions on this.\nI have a couple of tools which I have to update and deploy to a few servers every now and then. The source is managed in a SVN repository.\nTo save myself the bother ...
Recently I wrote a function to generate certain sequences with nontrivial constraints. The problem came with a natural recursive solution. Now it happens that, even for relatively small input, the sequences are several thousands, thus I would prefer to use my algorithm as a generator instead of using it to fill a list ...
Yes, you can turn your recursive function into a generator by using the `yield` statement, but you also need to ensure that you're yielding the permutations generated by the recursive calls. The issue in your current `getPermutations` implementation is that you're not actually yielding the results of the recursive call...
26,021
[ { "from": "human", "value": "Recently I wrote a function to generate certain sequences with nontrivial constraints. The problem came with a natural recursive solution. Now it happens that, even for relatively small input, the sequences are several thousands, thus I would prefer to use my algorithm as a gene...
Let's say I am modelling a process that involves a conversation or exchnage between two actors. For this example, I'll use something easily understandable:- Supplier creates a price list, Buyer chooses some items to buy and sends a Purchase Order, Supplier receives the purchase order and sends the goods. Supplier sen...
When modeling a process involving multiple actors and interactions, it’s important to balance the granularity of your use cases to ensure that you capture essential interactions while keeping the documentation manageable and comprehensible. Here’s a suggested approach to break down the scenario you provided, while stil...
22,410
[ { "from": "human", "value": "Let's say I am modelling a process that involves a conversation or exchnage between two actors. For this example, I'll use something easily understandable:-\n\nSupplier creates a price list,\nBuyer chooses some items to buy and sends a Purchase Order,\nSupplier receives the pur...
I get the following message in a VC6 project compile: OTE: WINVER has been defined as 0x0500 or greater which enables Windows NT 5.0 and Windows 98 features. When these headers were released, Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions. For this release when WINVER is defined as 0x050...
The message you're seeing is a warning from the Microsoft Visual C++ 6.0 (VC6) compiler regarding the version of the Windows SDK headers that you are using in your project. It indicates that your project is configured to target Windows NT 5.0 (Windows 2000) and Windows 98 with the `WINVER` macro defined as 0x0500 or hi...
24,078
[ { "from": "human", "value": "I get the following message in a VC6 project compile:\n\nOTE: WINVER has been defined as 0x0500 or greater which enables\n Windows NT 5.0 and Windows 98 features. When these headers were released,\n Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.\n Fo...
Can I access spring bean that exposed using http invoker (server) from GWT application (client)? If so is there any example / tutorial for that?
Yes, you can access a Spring bean exposed via HTTP Invoker from a GWT (Google Web Toolkit) application. GWT applications communicate with a server-side backend through remote procedure calls (RPC), and while GWT has its own RPC mechanism, you can also invoke HTTP-based services, including those exposed by Spring's HTTP...
22,993
[ { "from": "human", "value": "Can I access spring bean that exposed using http invoker (server) from GWT application (client)?\nIf so is there any example / tutorial for that?\n" }, { "from": "gpt", "value": "Yes, you can access a Spring bean exposed via HTTP Invoker from a GWT (Google Web Toolki...
PHP has a very nice function, isset($variableName). It checks if $variableName is already defined in the program or not. Can we build similar feature for C/C++ (some kind of symbol table lookup)?
In C/C++, there isn't a direct equivalent to PHP's `isset()` function, since C/C++ is statically typed and does not have dynamic variable types like PHP. However, you can implement a symbol table mechanism to track variable definitions and their status (defined or not). This can be done using a hash table or a map to s...
24,462
[ { "from": "human", "value": "PHP has a very nice function, isset($variableName). It checks if $variableName is already defined in the program or not.\nCan we build similar feature for C/C++ (some kind of symbol table lookup)?\n" }, { "from": "gpt", "value": "In C/C++, there isn't a direct equiva...
I have currently 200+ GB database that is using the DB2 built in backup to do a daily backup (and hopefully not restore - lol) But since that backup now takes more than 2.5 hours to complete I am looking into a Third party Backup and Restore utility. The version is 8.2 FP 14 But I will be moving soon to 9.1 and I also...
When considering third-party backup and restore utilities for IBM DB2 databases, especially given the size of your database and the need for efficiency, several options come to mind. Here are some of the well-regarded tools: 1. **IBM Spectrum Protect (formerly Tivoli Storage Manager)**: - This is a widely used solu...
24,863
[ { "from": "human", "value": "I have currently 200+ GB database that is using the DB2 built in backup to do a daily backup (and hopefully not restore - lol) But since that backup now takes more than 2.5 hours to complete I am looking into a Third party Backup and Restore utility. The version is 8.2 FP 14 Bu...
Is it possible to highlight text inside of a textarea using javascript? Either changing the background of just a portion of the text area or making a portion of the text selected?
Highlighting text within a `<textarea>` using pure HTML and JavaScript can be quite challenging because a `<textarea>` is meant for plain text input, and it does not support text styling or background color changes for individual portions of text. However, there are a few workarounds you can consider: ### 1. Using a `...
19,389
[ { "from": "human", "value": "Is it possible to highlight text inside of a textarea using javascript? Either changing the background of just a portion of the text area or making a portion of the text selected?\n" }, { "from": "gpt", "value": "Highlighting text within a `<textarea>` using pure HTM...
Is there a simple way to support wildcards ("*") when searching strings - without using RegEx? Users are supposed to enter search terms using wildcards, but should not have to deal with the complexity of RegEx: "foo*" => str.startswith("foo") "*foo" => str.endswith("foo") "*foo*" => "foo" in str (it gets more ...
Yes, there's a straightforward way to implement wildcard searches without using regular expressions. You can create a function that takes a search term with wildcards and checks if a given string matches the pattern based on your wildcard rules. Here's a simple implementation: ```python def wildcard_search(search_term...
24,548
[ { "from": "human", "value": "Is there a simple way to support wildcards (\"*\") when searching strings - without using RegEx?\nUsers are supposed to enter search terms using wildcards, but should not have to deal with the complexity of RegEx:\n\"foo*\" => str.startswith(\"foo\")\n\"*foo\" => str.endsw...
I created a simple class with a DependencyProperty. When setting the value, I observe that ValidateValueCallback is called before CoerceValueCallback. On wpftutorial and in other books, it is stated that coercion is called before validation.
In WPF (Windows Presentation Foundation), the sequence of callbacks for a `DependencyProperty` when a value is set or changed is indeed an important part of understanding how dependency properties work. According to the documentation and design of WPF, the typical order of operations when a value is changed on a `Depen...
23,710
[ { "from": "human", "value": "I created a simple class with a DependencyProperty. When setting the value, I observe that ValidateValueCallback is called before CoerceValueCallback.\nOn wpftutorial and in other books, it is stated that coercion is called before validation.\n" }, { "from": "gpt", "...
How can I set points on a 24h period spreaded by the Gaussian distributions? For example to have the peak at 10 o'clock?
To generate points over a 24-hour period that are spread according to a Gaussian (normal) distribution, centered around a specific time like 10:00 AM, you can follow these steps: ### Step 1: Define Your Parameters 1. **Mean (μ)**: This will be your peak time, which in this case is 10:00 AM. In hours since midnight, th...
20,723
[ { "from": "human", "value": "How can I set points on a 24h period spreaded by the Gaussian distributions? For example to have the peak at 10 o'clock?\n" }, { "from": "gpt", "value": "To generate points over a 24-hour period that are spread according to a Gaussian (normal) distribution, centered ...
In Visual Studio 2008 in a C# WinForms project, there is a button on a form. In the properties view, the property "Font" is set to "Arial Unicode MS". What do I need to put into the property "Text", so I get the unicode character \u0D15 displayed on the button? When I put \u0D15 into the "Text" property, the button dis...
In Visual Studio 2008, when you set the "Text" property of a button to display a Unicode character, you cannot simply enter the Unicode escape sequence (like `\u0D15`) directly into the properties window. Instead, you need to use the actual character represented by that Unicode value. The Unicode character U+0D15 corr...
27,250
[ { "from": "human", "value": "In Visual Studio 2008 in a C# WinForms project, there is a button on a form. In the properties view, the property \"Font\" is set to \"Arial Unicode MS\".\nWhat do I need to put into the property \"Text\", so I get the unicode character \\u0D15 displayed on the button?\nWhen I p...
I'm new to CakePHP but I've been though their FAQs and guides to no avail. This is so simple that I just must not be thinking straight: How can I access a parameter sent through the URL within my view files? Example: http://example.com/view/6 How would I take that parameter ("6") and cycle it through the controller t...
In CakePHP, accessing URL parameters and passing them through to your views is straightforward. Based on your example URL `http://example.com/view/6`, you can follow these steps to retrieve and use the parameter (`6` in this case) in your view. ### Step 1: Capture the ID in the Controller In your controller, you need...
24,167
[ { "from": "human", "value": "I'm new to CakePHP but I've been though their FAQs and guides to no avail. This is so simple that I just must not be thinking straight:\nHow can I access a parameter sent through the URL within my view files? \nExample: http://example.com/view/6\nHow would I take that parameter...
I've inherited a mobile app which sends auth credentials (userid/password) in the clear. I'd imagine that I have 2 choices: a) use TLS. b) write my own auth protocol. If I choose (b) what are the key guidelines that I must follow to make it it secure. e.g. how to avoid replay attacks, encryption strategies.
If you're considering writing your own authentication protocol instead of using Transport Layer Security (TLS), it's important to recognize that creating a secure protocol from scratch is exceptionally challenging and often leads to vulnerabilities if not done correctly. However, if you still wish to pursue option (b),...
18,771
[ { "from": "human", "value": "I've inherited a mobile app which sends auth credentials (userid/password) in the clear.\nI'd imagine that I have 2 choices:\na) use TLS.\nb) write my own auth protocol.\nIf I choose (b) what are the key guidelines that I must follow to make it it secure.\ne.g. how to avoid repl...
I'm needing to cache some data using System.Web.Caching.Cache. Not sure if it matters, but the data does not come from a database, but a plethora of custom objects. The ASP.NET MVC is fairly new to me and I'm wondering where it makes sense for this caching to occur? Model or Controller? At some level this makes sense t...
In ASP.NET MVC, caching can be implemented at different levels (Controller, Model, or View) depending on your requirements. Here’s a breakdown of how to approach caching in your application and where it makes sense to implement it. ### Caching at Different Levels 1. **Controller Level**: - Caching at the controll...
24,437
[ { "from": "human", "value": "I'm needing to cache some data using System.Web.Caching.Cache. Not sure if it matters, but the data does not come from a database, but a plethora of custom objects.\nThe ASP.NET MVC is fairly new to me and I'm wondering where it makes sense for this caching to occur?\nModel or C...
I am currently using MediaWiki as a documentation website, with login authenticated by LDAP. However, we have hit a snag. Certain pages contain sensitive information. For example links that say "click here to log in". I would like to be able to protect certain pages from being edited by just anyone. I would like to ...
In MediaWiki, you can use the built-in page protection features to restrict who can edit specific pages. This can be done by user groups, such as allowing only certain groups (like employees) to edit sensitive pages. Here's a step-by-step guide on how to set this up: ### Step 1: Define User Groups First, ensure that ...
22,934
[ { "from": "human", "value": "I am currently using MediaWiki as a documentation website, with login authenticated by LDAP.\nHowever, we have hit a snag. Certain pages contain sensitive information. For example links that say \"click here to log in\". I would like to be able to protect certain pages from be...
I have an existing Perl program that uses Getopt package and Getopt::Long::Configure with permute as one of the options. However, now I need to keep the order of the options entered by the user. There is an option $RETURN_IN_ORDER mentioned in the Long.pm, however doesn't seem to be used anywhere at all. When I pass r...
The `Getopt::Long` module does not support `return_in_order` directly in the way you are trying to use it. The error message you're seeing indicates that the module does not recognize `return_in_order` as a valid configuration option. The `permute` option indeed allows for more flexible ordering of command-line option...
22,228
[ { "from": "human", "value": "I have an existing Perl program that uses Getopt package and Getopt::Long::Configure with permute as one of the options. However, now I need to keep the order of the options entered by the user. There is an option $RETURN_IN_ORDER mentioned in the Long.pm, however doesn't seem t...
I am trying to prevent data races in a multihreaded server. My problem is the following: there is a List<RServer>, the type RServer is a class with several fields. Now, the server has several threads all running at the same time and they can modify both the List (adding more items) and the individual RServer instances ...
Your strategy of using locks to prevent data races in a multithreaded environment is a good starting point, but there are a few things to consider to ensure safety and avoid potential deadlocks. ### 1. Locking Strategy The locks you described should be used correctly to protect shared resources. Here’s how you can or...
23,374
[ { "from": "human", "value": "I am trying to prevent data races in a multihreaded server. My problem is the following: there is a List<RServer>, the type RServer is a class with several fields. Now, the server has several threads all running at the same time and they can modify both the List (adding more ite...
I work on a web game , I use asp.net mvc, linqtosql. I have 3 tables that store default game values: DefaultRegions, DefaultSubRegions and DefaultCountries. These 3 tables are related to each other thanks to primary / foreign keys. I need to copy the values of these tables into 3 tables called Regions, SubRegions and C...
To efficiently copy values from your default tables (`DefaultRegions`, `DefaultSubRegions`, `DefaultCountries`) into their corresponding tables (`Regions`, `SubRegions`, `Countries`) for a new game, while also ensuring that the relationships between these entities are correctly maintained, you can follow these steps: ...
23,486
[ { "from": "human", "value": "I work on a web game , I use asp.net mvc, linqtosql.\nI have 3 tables that store default game values: DefaultRegions, DefaultSubRegions and DefaultCountries. These 3 tables are related to each other thanks to primary / foreign keys.\nI need to copy the values of these tables int...
I get the warning "childNodes is null or not an object' with different line numbers, depending on which version of the library I reference (I've tried about three different versions of 1.2.6). Consequently, I get jack for jQuery intellisense. I can hack this to get it to work, but I'd rather not as I don't understand ...
The warning "childNodes is null or not an object" indicates that you are trying to access the `childNodes` property of a DOM element (`div` in this case) that is either `null` or not a valid object. This often happens when the DOM element has not been created or is not yet available at the time of access. The line you...
25,296
[ { "from": "human", "value": "I get the warning \"childNodes is null or not an object' with different line numbers, depending on which version of the library I reference (I've tried about three different versions of 1.2.6). Consequently, I get jack for jQuery intellisense.\nI can hack this to get it to work...
I have the following models. # app/models/domain/domain_object.rb class Domain::DomainObject < ActiveRecord::Base has_many :links_from, :class_name => "Link", :as => :from, :dependent => :destroy end # app/models/link.rb class Link < ActiveRecord::Base belongs_to :from, :polymorphic => true belongs_to :object_v...
In Rails, when using polymorphic associations with namespaced models, it’s important to ensure that the `from_type` in the association reflects the namespacing correctly. By default, Rails does not automatically use the full namespaced class name for the `from_type` column in polymorphic associations. In your case, `...
25,203
[ { "from": "human", "value": "I have the following models.\n# app/models/domain/domain_object.rb\nclass Domain::DomainObject < ActiveRecord::Base\n has_many :links_from, :class_name => \"Link\", :as => :from, :dependent => :destroy\nend\n\n# app/models/link.rb\nclass Link < ActiveRecord::Base\n belongs_to ...
I read some of the answers on here re: testing views and controllers, and mocking, but I still can't figure out how to test an ASP.NET MVC controller that reads and sets Session values (or any other context based variables.) How do I provide a (Session) context for my test methods? Is mocking the answer? Anybody have e...
Testing ASP.NET MVC controllers that rely on session variables can indeed be challenging, especially since session state is not easy to mock out of the box. However, there are a few strategies you can use to create a testable environment for your controller actions that rely on the session. ### Option 1: Mocking the H...
18,741
[ { "from": "human", "value": "I read some of the answers on here re: testing views and controllers, and mocking, but I still can't figure out how to test an ASP.NET MVC controller that reads and sets Session values (or any other context based variables.)\nHow do I provide a (Session) context for my test meth...
I have two arrays. One contains id=>count and the other contains id=>name. I'm trying to produce a single array that is name=>count. Any suggestions on a straightforward way to do this? I have looked at the Array Functions in the PHP Manual and didn't see anything that stood out as doing what I want, so I'm guessing I'...
You can achieve this in PHP using a simple `foreach` loop to iterate through the first array (which contains `id => count`) and map the `id` from that array to the corresponding `name` from the second array (which contains `id => name`). Here's a straightforward way to do it: ```php // Sample arrays $countArray = [ ...
24,498
[ { "from": "human", "value": "I have two arrays. One contains id=>count and the other contains id=>name. I'm trying to produce a single array that is name=>count. Any suggestions on a straightforward way to do this?\nI have looked at the Array Functions in the PHP Manual and didn't see anything that stood ou...
I've been creating some applications with SQLExpress and find myself, scripting the database creation, tables and other entities etc. after application installation. Is this the normal way? Thanks
Creating and managing databases programmatically after application installation is a common practice, especially in scenarios where the application needs to be easily deployable, portable, or updated. Here are a few considerations regarding this approach: ### 1. **Database Scripting**: - Scripting the database cre...
25,283
[ { "from": "human", "value": "I've been creating some applications with SQLExpress and find myself, scripting the database creation, tables and other entities etc. after application installation. Is this the normal way? \nThanks\n" }, { "from": "gpt", "value": "Creating and managing databases pro...
Here's the quick and skinny of my issue: $("a").toggle(function() { /*function A*/ }, function() { /*function B*/ }); Inside function A a form is displayed. If the user successfully completes the form, the form is hidden again (returning to it's original state). Inside function B the same form is hidden. The theory be...
Yes, you can programmatically reset the toggle switch to its initial state after the form is successfully filled out and hidden. One way to achieve this is by using a simple variable to keep track of the current state (whether the form is visible or hidden). You can then update this variable when the form is shown or...
25,310
[ { "from": "human", "value": "Here's the quick and skinny of my issue:\n$(\"a\").toggle(function() { /*function A*/ }, function() { /*function B*/ });\nInside function A a form is displayed. If the user successfully completes the form, the form is hidden again (returning to it's original state).\nInside fun...
What is the best datatype to use for storing moderate amounts of text in SQL Server (2005)? For example, imagine a table, storing information on downloads available on a website. I want a title for the download which is brief, say varchar(20). A path, say varchar(255) then I want to store some user friendly text about ...
In SQL Server 2005, when it comes to storing moderate amounts of text for descriptions, you have a few options, each with its own advantages and considerations. 1. **VARCHAR(n)**: You can specify a maximum length, such as `VARCHAR(4000)`. This is suitable if you have a good estimate of the maximum length of the text y...
26,752
[ { "from": "human", "value": "What is the best datatype to use for storing moderate amounts of text in SQL Server (2005)?\nFor example, imagine a table, storing information on downloads available on a website.\nI want a title for the download which is brief, say varchar(20). A path, say varchar(255) then I w...
Creating Traversals for Binary Search Tree with Recursion. void inOrder(void (*inOrderPtr)(T&)) { if(this->left != NULL) inOrder((*inOrderPtr)(this->left)); inOrderPtr(this->data); if(this->right != NULL) inOrder((*inOrderPtr)(this->right)); } Here is the function. Now this is ob...
The function you provided has several issues related to how recursion should be handled and how you are trying to dereference the function pointer. The main problem lies in the fact that you are trying to call `inOrderPtr` in a way that isn't correct for a function pointer. Here is a correct implementation of the `inO...
26,056
[ { "from": "human", "value": "Creating Traversals for Binary Search Tree with Recursion. \nvoid inOrder(void (*inOrderPtr)(T&)) \n{ \n if(this->left != NULL) \n inOrder((*inOrderPtr)(this->left)); \n inOrderPtr(this->data); \n if(this->right != NULL) \n inOrder((*inOrderPtr)(this->rig...
I'm writing a python script that executes a csh script in Solaris 10. The csh script prompts the user for the root password (which I know) but I'm not sure how to make the python script answer the prompt with the password. Is this possible? Here is what I'm using to execute the csh script: import commands commands.get...
To execute a `csh` script that requires user interaction (like entering a password) from a Python script, you'll need to use a different approach than just using `commands.getoutput()`, which does not handle interactive prompts. For this purpose, the `subprocess` module is more suitable, as it allows you to interact w...
24,747
[ { "from": "human", "value": "I'm writing a python script that executes a csh script in Solaris 10. The csh script prompts the user for the root password (which I know) but I'm not sure how to make the python script answer the prompt with the password. Is this possible? Here is what I'm using to execute the ...
Is there a way to tell Enterprise Library to use prepared statements? If so, how?
Enterprise Library, a collection of reusable software components designed to assist in common enterprise development challenges, does not explicitly provide a configuration option to use prepared statements. However, it does support parameterized queries, which effectively allow you to create prepared statements under ...
26,630
[ { "from": "human", "value": "Is there a way to tell Enterprise Library to use prepared statements? If so, how?\n" }, { "from": "gpt", "value": "Enterprise Library, a collection of reusable software components designed to assist in common enterprise development challenges, does not explicitly pr...
Should methods in a Java interface be declared with or without the public access modifier? Technically it doesn't matter, of course. A class method that implements an interface is always public. But what is a better convention? Java itself is not consistent in this. See for instance Collection vs. Comparable, or Future...
In Java, all methods declared in an interface are implicitly public and abstract, regardless of whether you explicitly specify the `public` modifier. Therefore, technically speaking, it doesn't matter whether you declare interface methods with or without the `public` access modifier. However, when it comes to conventi...
26,455
[ { "from": "human", "value": "Should methods in a Java interface be declared with or without the public access modifier?\nTechnically it doesn't matter, of course. A class method that implements an interface is always public. But what is a better convention?\nJava itself is not consistent in this. See for in...
what is the syntax for the sendkey for rightarrow in .net?
In .NET, particularly when you're using the `SendKeys` class from the `System.Windows.Forms` namespace, you can send keystrokes to the active application. To send the right arrow key using `SendKeys`, you would use the following syntax: ```csharp SendKeys.Send("{RIGHT}"); ``` Here's a simple example of how you might ...
28,263
[ { "from": "human", "value": "what is the syntax for the sendkey for rightarrow in .net?\n" }, { "from": "gpt", "value": "In .NET, particularly when you're using the `SendKeys` class from the `System.Windows.Forms` namespace, you can send keystrokes to the active application. To send the right a...
I have a solution with multiple projects and we need to do some serious global replacements. Is there a way to do a wildcard replacement where some values remain in after the replace? So, for instance if I want every HttpContext.Current.Session[“whatevervalue”] to become HttpContext.Current.Session[“whatevervalue”].ToS...
Yes, you can achieve this in Visual Studio using a regular expression (regex) in the "Find and Replace" feature. This will allow you to match a specific pattern while keeping the parts you want to remain unchanged. Here's how you can perform the replacement you described: 1. **Open the Find and Replace dialog**: -...
25,473
[ { "from": "human", "value": "I have a solution with multiple projects and we need to do some serious global replacements.\nIs there a way to do a wildcard replacement where some values remain in after the replace?\nSo, for instance if I want every HttpContext.Current.Session[“whatevervalue”] to become HttpC...
When I'm using an If statement and I want to check if a boolean is false should I use the "Not" keyword or just = false, like so If (Not myboolean) then vs If (myboolean = False) then Which is better practice and more readable?
Both approaches you mentioned for checking if a boolean value is `False` are valid, but they have different implications for readability and best practices. 1. **Using `Not`:** ```vb If (Not myboolean) Then ``` This approach is generally considered more readable and is a common practice in many programming...
27,555
[ { "from": "human", "value": "When I'm using an If statement and I want to check if a boolean is false should I use the \"Not\" keyword or just = false, like so\nIf (Not myboolean) then \n\nvs\nIf (myboolean = False) then\n\nWhich is better practice and more readable?\n" }, { "from": "gpt", "valu...
our partners sites leverages our iframes in their own websites. I was wondering if there is a way to track the analytics on the iframes. The problem is, if we also utilize these iframes on our own website, how do i avoid duplicate tracking where a visit is counted on our domain's analytics and also counted again in if...
Tracking analytics on iframes can be challenging, particularly when you're trying to avoid duplicate tracking between your main site and partner sites using those iframes. Here are several approaches to consider for tracking iframe analytics effectively while avoiding duplication: ### 1. **Use a Unique Identifier for ...
23,086
[ { "from": "human", "value": "our partners sites leverages our iframes in their own websites. I was wondering if there is a way to track the analytics on the iframes. \nThe problem is, if we also utilize these iframes on our own website, how do i avoid duplicate tracking where a visit is counted on our domai...
Why do some sites (or advertisers that give clients javascript code) employ a technique of splitting the <script> and/or </script> tags up within document.write() calls? I noticed that Amazon does this as well, for example: <script type='text/javascript'> if (typeof window['jQuery'] == 'undefined') document.write('<s...
The technique of splitting the `<script>` tags within `document.write()` calls, as you've observed in the code snippet from Amazon, is primarily a method to avoid issues related to script execution and to bypass certain filtering mechanisms. Here are some reasons why developers might use this approach: 1. **Avoiding H...
26,369
[ { "from": "human", "value": "Why do some sites (or advertisers that give clients javascript code) employ a technique of splitting the <script> and/or </script> tags up within document.write() calls?\nI noticed that Amazon does this as well, for example:\n<script type='text/javascript'>\n if (typeof window[...
On OS from win 2000 or later (any language) can I assume that this path will always exists? For example I know that on win xp in some languages the "Program Files" directory have a different name. So is it true for the System32 folder? Thanks. Ohad.
The `System32` folder is a critical part of the Windows operating system and is located within the `C:\Windows\System32` path. On Windows operating systems starting from Windows 2000 and continuing through Windows 10 and 11, you can generally assume that the `System32` folder will exist. It contains essential system ...
27,279
[ { "from": "human", "value": "On OS from win 2000 or later (any language) can I assume that this path will always exists?\nFor example I know that on win xp in some languages the \"Program Files\" directory have a different name.\nSo is it true for the System32 folder?\nThanks.\nOhad.\n" }, { "from":...
Given the following markup: <ul> <li>apple</li> <li class="highlight">orange</li> <li>pear</li> </ul> Both the uls and the lis widths appear to be 100%. If I apply a background-color to the list item, the highlight stretches the full width of the page. I only want the background highlight to stretch as wide a...
To constrain the width of your list items (`<li>`) so that the background highlight only stretches as wide as the widest item, you can achieve this by modifying the CSS to remove the default block-level behavior that allows them to expand to full width. Here's a simple approach to accomplish this: ### HTML Keep your ...
25,936
[ { "from": "human", "value": "Given the following markup:\n<ul>\n <li>apple</li>\n <li class=\"highlight\">orange</li>\n <li>pear</li>\n</ul>\n\nBoth the uls and the lis widths appear to be 100%. If I apply a background-color to the list item, the highlight stretches the full width of the page.\nI only...
I have a reference to a type, for which I would like to retrieve the version number of the Assembly in which it is located. What is the best way to do this?
To retrieve the version number of the assembly for a given type in .NET, you can use reflection. The `Assembly` class provides a way to get information about the assembly that contains a specific type. Below is a simple example of how you can achieve this in C#: ```csharp using System; using System.Reflection; public...
25,324
[ { "from": "human", "value": "I have a reference to a type, for which I would like to retrieve the version number of the Assembly in which it is located.\nWhat is the best way to do this?\n" }, { "from": "gpt", "value": "To retrieve the version number of the assembly for a given type in .NET, you...
Is there a class in the standard library of .NET that gives me the functionality to create random variables that follow Gaussian distribution?
As of .NET 6 and later, the standard library does not include a dedicated class specifically for generating random numbers following a Gaussian (normal) distribution. However, you can easily implement this functionality using the `System.Random` class. Here’s a simple implementation of generating random numbers that f...
24,362
[ { "from": "human", "value": "Is there a class in the standard library of .NET that gives me the functionality to create random variables that follow Gaussian distribution? \n" }, { "from": "gpt", "value": "As of .NET 6 and later, the standard library does not include a dedicated class specifical...
Is the F# is the future of programming languages? Is it right time to learn F# ? Any other languages in the market which is equivalent to F#?
F# is a functional-first programming language that runs on the .NET platform and is particularly known for its strong type inference, immutability by default, and support for functional programming paradigms. Whether F# is "the future" of programming languages depends on several factors, including industry trends, comm...
22,864
[ { "from": "human", "value": "Is the F# is the future of programming languages? Is it right time to learn F# ? Any other languages in the market which is equivalent to F#?\n" }, { "from": "gpt", "value": "F# is a functional-first programming language that runs on the .NET platform and is particul...
Is it possible to prevent the browser from following redirects when sending XMLHttpRequest-s (i.e. to get the redirect status code back and handle it myself)?
In standard web browsers, when you use `XMLHttpRequest` to make an HTTP request, the browser automatically follows any redirects (HTTP status codes 3xx) for you. Unfortunately, there isn't a built-in way to prevent this automatic behavior and directly capture the redirect status codes in the response of a `XMLHttpReque...
25,984
[ { "from": "human", "value": "Is it possible to prevent the browser from following redirects when sending XMLHttpRequest-s (i.e. to get the redirect status code back and handle it myself)?\n" }, { "from": "gpt", "value": "In standard web browsers, when you use `XMLHttpRequest` to make an HTTP req...
I need a regex that matches all strings ending in .cs, but if they end in .g.cs they should not match. I'm using .NET regular expressions.
You can use the following regular expression to match strings ending in `.cs` but not those that end in `.g.cs`: ```regex (?<!\.g)\.cs$ ``` ### Explanation: - `(?<!\.g)` is a negative lookbehind assertion that ensures the substring `.g` does not precede `.cs`. This way, strings that end in `.g.cs` will not match. - ...
29,052
[ { "from": "human", "value": "I need a regex that matches all strings ending in .cs, but if they end in .g.cs they should not match. I'm using .NET regular expressions.\n" }, { "from": "gpt", "value": "You can use the following regular expression to match strings ending in `.cs` but not those tha...
I'd like to stick a class down in my folder hierarchy. The scenario is too trivial to warrant it's own project or separate website. However, I hate to clutter my top-level App_Code with something that's used by a tiny corner of the site. Is there a way in web.config to include another file or folder in the compilatio...
In ASP.NET, you cannot directly include additional files or folders in the compilation process via the `web.config` file. However, there are a few strategies you can use to organize your code without cluttering your `App_Code` directory: ### 1. Create a Subfolder in App_Code You can create a subfolder within the `App_...
26,075
[ { "from": "human", "value": "I'd like to stick a class down in my folder hierarchy. The scenario is too trivial to warrant it's own project or separate website. However, I hate to clutter my top-level App_Code with something that's used by a tiny corner of the site.\nIs there a way in web.config to includ...
A strict equality operator will tell you if two object types are equal. However, is there a way to tell if two objects are equal, much like the hash code value in Java? Stack Overflow question Is there any kind of hashCode function in JavaScript? is similar to this question, but requires a more academic answer. The sce...
In JavaScript, there isn't a built-in hash code function for objects like there is in Java. Java's hash code is typically used in conjunction with the `equals` method to allow objects to be compared for equality, particularly when used in collections such as `HashMap`. However, there are ways to achieve similar functi...
23,333
[ { "from": "human", "value": "A strict equality operator will tell you if two object types are equal. However, is there a way to tell if two objects are equal, much like the hash code value in Java?\nStack Overflow question Is there any kind of hashCode function in JavaScript? is similar to this question, bu...
I have a 2D character array: char nm[MAX1][MAX2] = { "john", "bob", "david" }; I want to swap two of these elements (without std::swap) by simply writing swapPointers(nm[0], nm[1]); where swapPointers looks like this void swapPointers(char *&a, char *&b) { char *temp = a; a = b; b = a; } Howeve...
The issue you're encountering arises from the fact that you're trying to swap the strings in a 2D character array using pointers, but the way you're passing the pointers to the `swapPointers` function is not valid. In your 2D character array `nm`, each element is actually an array of characters, not a pointer to a cha...
23,442
[ { "from": "human", "value": "I have a 2D character array:\nchar nm[MAX1][MAX2] = { \"john\", \"bob\", \"david\" };\nI want to swap two of these elements (without std::swap) by simply writing\nswapPointers(nm[0], nm[1]);\nwhere swapPointers looks like this \nvoid swapPointers(char *&a, char *&b) \n{ \n ...
Recently, I noticed some people mentioning that std::list::size() has a linear complexity. According to some sources, this is in fact implementation dependent as the standard doesn't say what the complexity has to be. The comment in this blog entry says: Actually, it depends on which STL you are using. Microsoft Vis...
The complexity of `std::list::size()` in C++ is indeed implementation-dependent, but as of the later C++ standards and most modern implementations, `std::list` in standard libraries like GCC and MSVC typically maintains a size member variable that allows for constant-time complexity when calling `size()`. ### Historic...
22,733
[ { "from": "human", "value": "Recently, I noticed some people mentioning that std::list::size() has a linear complexity.\nAccording to some sources, this is in fact implementation dependent as the standard doesn't say what the complexity has to be.\nThe comment in this blog entry says:\n\nActually, it depend...
How do I distribute a small amount of data in a random order in a much larger volume of data? For example, I have several thousand lines of 'real' data, and I want to insert a dozen or two lines of control data in a random order throughout the 'real' data. Now I am not trying to ask how to use random number generators,...
To achieve an even and random distribution of control data among your real data without revealing which rows are control or real, you can use the following approach. This combines statistical randomness with a structure that helps to avoid the clumping you are concerned about. ### Step-by-Step Process: 1. **Determine...
23,254
[ { "from": "human", "value": "How do I distribute a small amount of data in a random order in a much larger volume of data?\nFor example, I have several thousand lines of 'real' data, and I want to insert a dozen or two lines of control data in a random order throughout the 'real' data.\nNow I am not trying ...
The general problem: We have urls coming to our IIS web servers formatted like: http://www.server.com/page.aspx We are also seeing that urls like this are coming in: http://www.server.com//page.aspx We would like to get rid of that extra path character because when the user agent is Internet Explorer, this is res...
To address the issue of duplicate URLs with extra slashes in IIS, you can implement a URL rewriting rule to redirect requests with double slashes to their single-slash equivalents. This will ensure that users and user agents (like browsers) access only one version of the URL, thus avoiding issues related to caching and...
21,025
[ { "from": "human", "value": "The general problem:\nWe have urls coming to our IIS web servers formatted like: \n\nhttp://www.server.com/page.aspx\n\nWe are also seeing that urls like this are coming in: \n\nhttp://www.server.com//page.aspx\n\nWe would like to get rid of that extra path character because whe...