instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I have a mysql table that relies on the unix epoch time stamp equivalent of the date of the entry to sort and filter in various parts of the website. I'm trying to implement a date picker that will enter the date into the form field in the mm/dd/yyyy format. I've been struggling with converting that date into the unix ... | It looks like you're on the right track, and the confusion likely comes from how you're extracting and converting the date string from the form. You're correct that `mktime` expects individual numeric components, but since you're dealing with a date string in the `mm/dd/yyyy` format, the best approach is to use `strtot... | 44,386 | [
{
"from": "human",
"value": "I have a mysql table that relies on the unix epoch time stamp equivalent of the date of the entry to sort and filter in various parts of the website. I'm trying to implement a date picker that will enter the date into the form field in the mm/dd/yyyy format. I've been struggling... |
I'm trying to design a homepage for an MVC site that has two different views, based on if the user is logged in or not.
So image the default (not logged in) view is showing general, nonspecific info. If i'm logged in, the view is showing mostly personal stuff instead.
What's the best practice to handling this? Don't fo... | Designing a homepage for an MVC (Model-View-Controller) application that displays different content based on the user's authentication status is a common scenario. Below are best practices to handle this scenario effectively, along with some guidance on how to implement unit tests for it.
### Best Practices for Handli... | 37,303 | [
{
"from": "human",
"value": "I'm trying to design a homepage for an MVC site that has two different views, based on if the user is logged in or not.\nSo image the default (not logged in) view is showing general, nonspecific info. If i'm logged in, the view is showing mostly personal stuff instead.\nWhat's t... |
I had this answer on another post I asked:
"I believe the VS designer does it [components of a menustrip/statusstrip] by getting an instance of the control's designer (see the Designer attribute), and, if the designer is a ComponentDesigner, getting the AssociatedComponents property."
How do I do this? I'm not even sur... | To achieve what you're looking to do, you need to work with the Windows Forms designer in Visual Studio, particularly by extending the designer for a specific control like `MenuStrip` or `StatusStrip`. Here's a breakdown of how to start and implement this:
1. **Create a Custom Designer**: First, you need to create a c... | 41,111 | [
{
"from": "human",
"value": "I had this answer on another post I asked:\n\"I believe the VS designer does it [components of a menustrip/statusstrip] by getting an instance of the control's designer (see the Designer attribute), and, if the designer is a ComponentDesigner, getting the AssociatedComponents pr... |
By definition algorithms are independent from the medium they run on. E.g. I use Excel tables to play with data structures and to do some move/shuffling/marking experiments before implementing an algorithm in a programming language.
What tools and techniques do you use to design and simulate the function of an algorit... | Designing and simulating algorithms can be approached in various ways, depending on the complexity of the algorithm and the context in which it's being applied. Here are some tools and techniques commonly used to design and simulate algorithms:
### Tools and Techniques
1. **Flowcharts and Diagrams**:
- **Drawing P... | 43,863 | [
{
"from": "human",
"value": "By definition algorithms are independent from the medium they run on. E.g. I use Excel tables to play with data structures and to do some move/shuffling/marking experiments before implementing an algorithm in a programming language. \nWhat tools and techniques do you use to desi... |
I'm trying to implement a KeyListener for my JFrame. On the constructor, I'm using this code:
System.out.println("test");
addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) { System.out.println( "tester"); }
public void keyReleased(KeyEvent e) { System.out.println("2test2"); }
public vo... | You are correct in suspecting that the issue might be related to focus. In Java Swing, key events are dispatched to the component that currently has focus. By default, a `JFrame` does not gain focus automatically when it is created, so the `KeyListener` may not be receiving events as expected.
To ensure that your `JFr... | 42,285 | [
{
"from": "human",
"value": "I'm trying to implement a KeyListener for my JFrame. On the constructor, I'm using this code:\nSystem.out.println(\"test\");\naddKeyListener(new KeyListener() {\n public void keyPressed(KeyEvent e) { System.out.println( \"tester\"); }\n\n public void keyReleased(KeyEvent e... |
i have never used LINQ in any of my projects , i have always used ado.net /OR tool in my Business App projects , so i want to know
What are the benefits of LINQ ? why and when anybody should use LINQ ?
| Language Integrated Query (LINQ) is a powerful feature in .NET that provides a consistent way to query data from various sources like databases, collections, XML, and more, using C# or VB.NET syntax. Here are some benefits of using LINQ, along with reasons and scenarios when it should be considered:
### Benefits of LI... | 40,871 | [
{
"from": "human",
"value": "i have never used LINQ in any of my projects , i have always used ado.net /OR tool in my Business App projects , so i want to know\nWhat are the benefits of LINQ ? why and when anybody should use LINQ ?\n"
},
{
"from": "gpt",
"value": "Language Integrated Query (LINQ... |
I'm new to .NET, so please be patient with me ;)
On my Windows Form, I have a DataGridView that is bound to a data source. Since my grid is read-only, I have a set of controls (textbox, checkbox, etc.) outside the grid that will be used to edit the data.
I want the controls to be binded to the currently selected row in... | You're on the right track! To bind controls to the currently selected row in a `DataGridView`, you need to update the bindings on the controls whenever the selected row changes. The `DataGridView` itself does not automatically update the bindings of your controls just by sharing the same data source. Here's how you can... | 38,060 | [
{
"from": "human",
"value": "I'm new to .NET, so please be patient with me ;)\nOn my Windows Form, I have a DataGridView that is bound to a data source. Since my grid is read-only, I have a set of controls (textbox, checkbox, etc.) outside the grid that will be used to edit the data.\nI want the controls to... |
Is T-SQL's CASE lazy evaluation?
| In T-SQL (Transact-SQL), the `CASE` expression does exhibit a form of lazy evaluation, which means it evaluates only the conditions necessary to determine the outcome and stops evaluating once a match is found.
Here's how it works:
1. **Sequential Evaluation**: The `CASE` expression checks each condition sequentially... | 46,280 | [
{
"from": "human",
"value": "Is T-SQL's CASE lazy evaluation?\n"
},
{
"from": "gpt",
"value": "In T-SQL (Transact-SQL), the `CASE` expression does exhibit a form of lazy evaluation, which means it evaluates only the conditions necessary to determine the outcome and stops evaluating once a match ... |
I want to monitor the modifications in a specified directory, and retrieve the exact change information. So I've decided to use the ReadDirectoryChangesW() function. But I want to use it asynchronously, which means I don't want my worker thread to be blocked if there are no changes in the directory.
How can I do this?
| To monitor a directory asynchronously using the `ReadDirectoryChangesW` function, you will typically set it up in a worker thread and use an event or IO completion port to handle the notifications without blocking the thread.
Here’s a general approach to achieve this in a Windows environment:
### Step-by-Step Impleme... | 41,050 | [
{
"from": "human",
"value": "I want to monitor the modifications in a specified directory, and retrieve the exact change information. So I've decided to use the ReadDirectoryChangesW() function. But I want to use it asynchronously, which means I don't want my worker thread to be blocked if there are no chan... |
I'm attempting to check that a file exists before including it with Server.Execute in Classic ASP. While FileExists() returns False, Server.Execute successfully executes the file. Both calls use the exact same file path.
Why does this happen and how can I work around it?
| In Classic ASP, you might encounter a situation where `FileExists()` returns `False` for a file that can still be executed using `Server.Execute()`. This discrepancy can often be attributed to how paths are resolved or permissions related to file access. Here are several reasons why this might happen and some workaroun... | 44,091 | [
{
"from": "human",
"value": "I'm attempting to check that a file exists before including it with Server.Execute in Classic ASP. While FileExists() returns False, Server.Execute successfully executes the file. Both calls use the exact same file path.\nWhy does this happen and how can I work around it?\n"
}... |
The documentation of the Python readline module says "Availability: Unix". However, it doesn't appear to be available on OS X, although other modules marked as Unix are available. Here is what I'm using:
$ uname -a
Darwin greg.local 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~... | If you're encountering issues with the `readline` module not being available on your version of Python for macOS (OS X), here are several steps you can take to enable `readline` functionality.
### Option 1: Use MacPorts to Install Python with Readline Support
1. **Install MacPorts**: If you haven't already, you need ... | 42,831 | [
{
"from": "human",
"value": "The documentation of the Python readline module says \"Availability: Unix\". However, it doesn't appear to be available on OS X, although other modules marked as Unix are available. Here is what I'm using:\n\n$ uname -a\nDarwin greg.local 8.11.1 Darwin Kernel Version 8.11.1: Wed... |
Suppose I have a table with a numeric column (lets call it "score").
I'd like to generate a table of counts, that shows how many times scores appeared in each range.
For example:
score range | number of occurrences
-------------------------------------
0-9 | 11
10-19 | 14
20-29 | ... | You can achieve this using SQL if your data is stored in a relational database, or you can use programming languages like Python or R if you're working with a DataFrame. Below are a few methods for creating a count of occurrences in specified score ranges.
### Using SQL
If you're working with an SQL database, you can... | 43,441 | [
{
"from": "human",
"value": "Suppose I have a table with a numeric column (lets call it \"score\").\nI'd like to generate a table of counts, that shows how many times scores appeared in each range.\nFor example:\n\nscore range | number of occurrences\n-------------------------------------\n 0-9 | ... |
I'd like to try out Eclipse, but I'm a bit baffled with all the different distributions of it. I mainly program in Python doing web development, but I also need to maintain PHP and Perl apps. It looks like EasyEclipse is a bit behind. Should I just grab the base Eclipse and start loading plug-ins?
| Eclipse is indeed a powerful IDE, and while there are several distributions, starting with the base Eclipse IDE and adding the necessary plugins is a good approach, especially for your specific needs.
Here's how you can set it up for Python, PHP, and Perl development:
1. **Download Base Eclipse**: Start by downloadin... | 44,947 | [
{
"from": "human",
"value": "I'd like to try out Eclipse, but I'm a bit baffled with all the different distributions of it. I mainly program in Python doing web development, but I also need to maintain PHP and Perl apps. It looks like EasyEclipse is a bit behind. Should I just grab the base Eclipse and star... |
Let's say I have a source file with many preprocessor directives. Is it possible to see how it looks after the preprocessor is done with it?
| Yes, you can see the output of a source file after the C/C++ preprocessor has processed it by using the appropriate compiler command-line options. Here’s how you can do this for different compilers:
### For GCC (GNU Compiler Collection)
You can use the `-E` option with the GCC command. This will run the preprocessor ... | 44,867 | [
{
"from": "human",
"value": "Let's say I have a source file with many preprocessor directives. Is it possible to see how it looks after the preprocessor is done with it?\n"
},
{
"from": "gpt",
"value": "Yes, you can see the output of a source file after the C/C++ preprocessor has processed it by... |
In a database I am designing I have implemented profile based object level security.
Each user can view, edit, insert, update database tables according to the profiles (roles) he is a member of.
Now there is a need to implement "External Users" who can view only the relevant records and edit some of them (but not the b... | Implementing record-level security for external users in your database requires careful design to ensure that users can only access the specific records they are permitted to see and modify. Here are some ideas on how to structure this:
### 1. Record Ownership Model
This approach involves establishing a clear ownershi... | 41,381 | [
{
"from": "human",
"value": "In a database I am designing I have implemented profile based object level security.\nEach user can view, edit, insert, update database tables according to the profiles (roles) he is a member of.\nNow there is a need to implement \"External Users\" who can view only the relevant... |
OS: Windows Vista Business SP1
IDE: Visual Studio 2008 SP1
Question: when I create a new web application in VS 2008 and start it, the embedded web server from VS 2008 launches on one port (say 50140). Then the browser (IE7) automatically launches with address http://localhost:50137/..., note the different port number. ... | The issue you are experiencing with Visual Studio 2008 on Windows Vista, where the web server is launching on one port and Internet Explorer is trying to access a different port, is not uncommon. Here are several steps you can take to resolve this issue:
### Step 1: Check Project Properties
1. In Visual Studio 2008, r... | 44,404 | [
{
"from": "human",
"value": "OS: Windows Vista Business SP1\nIDE: Visual Studio 2008 SP1\nQuestion: when I create a new web application in VS 2008 and start it, the embedded web server from VS 2008 launches on one port (say 50140). Then the browser (IE7) automatically launches with address http://localhost:... |
What is a proxy object in the Inversion of Control / Aspect-Oriented sense?
Any good articles on what a proxy object is ?
Why you would want to use one ?
And how to write one in C# ?
| ### What is a Proxy Object?
In the context of Inversion of Control (IoC) and Aspect-Oriented Programming (AOP), a **proxy object** is a design pattern that acts as an intermediary for another object, allowing you to control access to it or add additional behavior (like logging, security, or transactions) without modif... | 40,203 | [
{
"from": "human",
"value": "What is a proxy object in the Inversion of Control / Aspect-Oriented sense?\nAny good articles on what a proxy object is ?\nWhy you would want to use one ?\nAnd how to write one in C# ? \n"
},
{
"from": "gpt",
"value": "### What is a Proxy Object?\n\nIn the context ... |
We have a client (who has a client, who has a client) who is driving us mad with change requests to a code base (in PHP). Our first response was to just work in a main trunk in SVN, but the client often comes back and requests that a certain change needs to get pushed to the live servers ASAP. On the other hand, other ... | It sounds like you've navigated a challenging situation with your client and have evolved your approach over time. Transitioning from SVN to Git is a significant improvement, as Git offers a more flexible branching model that can help manage change requests more effectively.
Here are some thoughts and additional sugge... | 42,474 | [
{
"from": "human",
"value": "We have a client (who has a client, who has a client) who is driving us mad with change requests to a code base (in PHP). Our first response was to just work in a main trunk in SVN, but the client often comes back and requests that a certain change needs to get pushed to the liv... |
I plan on using MySQL and it's built-in encryption functionality to encrypt / decrypt certain columns in certain tables. The concern I have is that I need to store the key somewhere. I could certainly store the key in a file and control the permissions of that file and the permissions of the application that accesses... | When it comes to securely storing and managing encryption keys, there are several important considerations. Unfortunately, there isn't a one-size-fits-all solution, and it often involves trade-offs between security, complexity, and ease of use. Here are some approaches you can consider for securely managing encryption ... | 42,409 | [
{
"from": "human",
"value": "I plan on using MySQL and it's built-in encryption functionality to encrypt / decrypt certain columns in certain tables. The concern I have is that I need to store the key somewhere. I could certainly store the key in a file and control the permissions of that file and the per... |
I'd like to copy the files that have a specific file extension to a new folder. I have an idea how to use os.walk but specifically how would I go about using that? I'm searching for the files with a specific file extension in only one folder (this folder has 2 subdirectories but the files I'm looking for will never be ... | You can indeed use `os.walk` to traverse directories in Python, but since you only want to search for files in a specific folder (without descending into its subdirectories), a simpler approach using `os.listdir` would suffice. However, if you prefer to use `os.walk`, I'll provide examples for both methods.
### Using ... | 42,458 | [
{
"from": "human",
"value": "I'd like to copy the files that have a specific file extension to a new folder. I have an idea how to use os.walk but specifically how would I go about using that? I'm searching for the files with a specific file extension in only one folder (this folder has 2 subdirectories but... |
In my LOB apps I usually wind up with containers that contain a bunch of different textblocks and textboxes for users to enter data. Normally I need to apply a certain margin or vertical/horizontal alignment to each control.
Let's say I have Grid on my form that looks like this (a lot of markup was eliminated for brevi... | In WPF (Windows Presentation Foundation), managing styles for controls like `TextBlock` and `TextBox` efficiently is a common requirement, especially in line-of-business applications where consistency and maintainability are key. Based on the considerations you've presented, here are some effective approaches to handle... | 40,987 | [
{
"from": "human",
"value": "In my LOB apps I usually wind up with containers that contain a bunch of different textblocks and textboxes for users to enter data. Normally I need to apply a certain margin or vertical/horizontal alignment to each control.\nLet's say I have Grid on my form that looks like this... |
Does anyone know of a good tool to test load and stress on webservices? I've been looking at Watir and Selenium, but there more web page centered.
| For load and stress testing specifically targeted at web services (APIs), there are several tools that are better suited than Watir or Selenium, which are primarily designed for browser automation. Here are some popular tools you can consider:
1. **Apache JMeter**: A highly popular open-source tool that allows you to ... | 46,336 | [
{
"from": "human",
"value": "Does anyone know of a good tool to test load and stress on webservices? I've been looking at Watir and Selenium, but there more web page centered.\n"
},
{
"from": "gpt",
"value": "For load and stress testing specifically targeted at web services (APIs), there are sev... |
Subreports overlap in this example -- what am I doing wrong? The second one is supposed to "float" below the first one, with its 'y' attribute being ignored, but it isn't.
Thanks !!
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.o... | In your JasperReports XML configuration, the issue with the overlapping subreports stems from how the positioning of the report elements is set up.
Here are some adjustments and explanations that should help resolve the overlapping issue and ensure the second subreport floats below the first:
1. **PositionType**: En... | 42,714 | [
{
"from": "human",
"value": "Subreports overlap in this example -- what am I doing wrong? The second one is supposed to \"float\" below the first one, with its 'y' attribute being ignored, but it isn't.\nThanks !!\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<jasperReport xmlns=\"http://jasperreports.source... |
The Drupal API has drupal_get_path($type, $name) which will give the path of any particular theme or module. What if I want the path of the current theme?
| To get the path of the current theme in Drupal, you can use the `drupal_get_path()` function in conjunction with the `\Drupal::theme()->getActiveTheme()->getName()` method to retrieve the name of the active theme. Here’s how you can do it:
```php
$current_theme = \Drupal::theme()->getActiveTheme()->getName();
$current... | 47,973 | [
{
"from": "human",
"value": "The Drupal API has drupal_get_path($type, $name) which will give the path of any particular theme or module. What if I want the path of the current theme?\n"
},
{
"from": "gpt",
"value": "To get the path of the current theme in Drupal, you can use the `drupal_get_pa... |
We have two client apps (a web app and an agent app) accessing methods on the same service, but with slightly different requirements. My team wants to control behaviour on the service side by passing in a ApplicationType parameter to every method - which is essentially an enum containing the name of the calling client... | Your concerns about passing an `ApplicationType` parameter to each method call are valid, and it's great that you're thinking critically about how to design your service. Let's explore the implications and potential alternatives for this approach.
### Concerns with ApplicationType Parameter
1. **Coupling**: Passing a... | 42,655 | [
{
"from": "human",
"value": "We have two client apps (a web app and an agent app) accessing methods on the same service, but with slightly different requirements. My team wants to control behaviour on the service side by passing in a ApplicationType parameter to every method - which is essentially an enum ... |
My simplified and contrived example is the following:-
Lets say that I want to measure and store the temperature (and other values) of all the worlds' towns on a daily basis. I am looking for an optimal way of storing the data so that it is just as easy to get the current temperature in all the towns, as it is to get a... | The problem you've outlined is a classic scenario in database design, where you need to balance the efficiency of current data access with the ability to retain and query historical data. Below are some considerations for both options you've presented, along with some potential alternatives that might fit your use case... | 41,363 | [
{
"from": "human",
"value": "My simplified and contrived example is the following:-\nLets say that I want to measure and store the temperature (and other values) of all the worlds' towns on a daily basis. I am looking for an optimal way of storing the data so that it is just as easy to get the current tempe... |
Is it possible to get a device to open a file on disk using the MIDlet.platformRequest(String url) method? I was hoping to use the following:
midlet.platformRequest("file:///path/to/file/file.png");
But this just throws a ConnectionNotFound exception. I'm specifically using the BlackBerry platform, but I do not have a... | Using `MIDlet.platformRequest(String url)` in a Java ME application, particularly on the BlackBerry platform, can be somewhat limited due to how the platform handles URIs and the permissions granted to MIDlets.
In the case of BlackBerry, the `platformRequest` method is typically used to request the opening of URLs or ... | 44,575 | [
{
"from": "human",
"value": "Is it possible to get a device to open a file on disk using the MIDlet.platformRequest(String url) method? I was hoping to use the following:\nmidlet.platformRequest(\"file:///path/to/file/file.png\");\n\nBut this just throws a ConnectionNotFound exception. I'm specifically usin... |
We are using popup windows in a Silverlight 2 application; these can be moved in the standard way by clicking on the title bar and dragging. If the title bar is dragged out of site behind the browser chrome, the window can no longer be moved.
We have users that consider this problematic and I was wondering if there mi... | Dealing with popup windows in Silverlight applications can be a challenge, particularly when it comes to preventing users from accidentally dragging them behind the browser chrome. Here are some potential solutions to address the issues you've described:
### 1. Constrain Popup Movement
To prevent the popup window fro... | 43,017 | [
{
"from": "human",
"value": "We are using popup windows in a Silverlight 2 application; these can be moved in the standard way by clicking on the title bar and dragging. If the title bar is dragged out of site behind the browser chrome, the window can no longer be moved.\nWe have users that consider this p... |
What's the best method for benchmarking the performance of my various templates when using Template::Toolkit?
I want something that will break down how much cpu/system time is spent processing each block or template file, exclusive of the time spent processing other templates within. Devel::DProf, for example, is use... | Benchmarking Template Toolkit templates to get a detailed breakdown of CPU/system time spent on each block or template file requires some custom instrumentation since most general profiling tools, like `Devel::DProf`, do not provide the fine-grained control you need.
Here are steps and methods you can use to benchmark... | 40,839 | [
{
"from": "human",
"value": "What's the best method for benchmarking the performance of my various templates when using Template::Toolkit? \nI want something that will break down how much cpu/system time is spent processing each block or template file, exclusive of the time spent processing other templates ... |
I've rm'ed a 2.5gb log file - but it doesn't seemed to have freed any space.
I did:
rm /opt/tomcat/logs/catalina.out
then this:
df -hT
and df reported my /opt mount still at 100% used.
Any suggestions?
| When you delete a file in Linux using `rm`, the space it occupied will not be freed if that file is still being held open by a process. This is common with log files, particularly with applications like Tomcat that may continue to write to them even after they've been deleted.
To free up the space, you can follow thes... | 39,732 | [
{
"from": "human",
"value": "I've rm'ed a 2.5gb log file - but it doesn't seemed to have freed any space.\nI did:\nrm /opt/tomcat/logs/catalina.out\n\nthen this:\ndf -hT\n\nand df reported my /opt mount still at 100% used.\nAny suggestions?\n"
},
{
"from": "gpt",
"value": "When you delete a file... |
What is the proper way to load a ListBox in C# .NET 2.0 Winforms?
I thought I could just bind it to a DataTable. No such luck.
I thought I could bind it with a Dictionary. No luck.
Do I have to write an class called KeyValuePair, and then use List<KeyValuePair> just to be able to load this thing with objects? Maybe I... | In .NET 2.0 WinForms, you can indeed bind a `ListBox` to a collection of objects, but you need to provide a way for the `ListBox` to display the appropriate text and associate it with an underlying value.
You're correct that you have a few options here. The most straightforward approach is to use a `List` of a simple... | 44,003 | [
{
"from": "human",
"value": "What is the proper way to load a ListBox in C# .NET 2.0 Winforms?\nI thought I could just bind it to a DataTable. No such luck.\nI thought I could bind it with a Dictionary. No luck. \nDo I have to write an class called KeyValuePair, and then use List<KeyValuePair> just to be a... |
My first instinct is to say each key is an object, and has a hash code, which is what is used to determine if a duplicate is being inserted. However, I can't find anything to back that up for sure. Can someone provide a link that says that, or provide the real answer here? Thanks!
| Your instinct about how keys work in hash tables (or hash maps) is generally correct. Each key in a hash table is associated with a hash code, which is used to determine its position within the underlying data structure. The hash code helps in identifying whether a key is already present in the table (to avoid duplicat... | 45,100 | [
{
"from": "human",
"value": "My first instinct is to say each key is an object, and has a hash code, which is what is used to determine if a duplicate is being inserted. However, I can't find anything to back that up for sure. Can someone provide a link that says that, or provide the real answer here? Thank... |
I have only this in my mxml source code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:comp="components.*"
width="770" height="330">
<mx:Label x="185.5" y="150"
text="Placeholder for Future UI." fontSize="30" color="#93A8AD"/>
</mx:Canvas... | The error you're encountering in Flex Builder indicates that there's an issue with the root element of your MXML document. In MXML, you need to ensure that the root element is a valid container or component that is recognized by the Flex framework.
In your case, the root element `<mx:Canvas>` is appropriate, but the ... | 43,503 | [
{
"from": "human",
"value": "I have only this in my mxml source code:\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<mx:Canvas xmlns:mx=\"http://www.adobe.com/2006/mxml\"\n xmlns:comp=\"components.*\"\n width=\"770\" height=\"330\">\n <mx:Label x=\"185.5\" y=\"150\" \ntext=\"Placehol... |
What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime?
Consider the following sample code - inside the Example() method, what's the most concise way to invoke GenericMethod<T>() using the Type stored in the myType variable?
publi... | To call a generic method when the type parameter is determined at runtime, you can use reflection. Since generics are resolved at compile time, you'll need to construct the method call dynamically.
Here's how you can achieve that:
1. Use the `MethodInfo` class to get a reference to the generic method.
2. Make it gene... | 44,308 | [
{
"from": "human",
"value": "What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime?\nConsider the following sample code - inside the Example() method, what's the most concise way to invoke GenericMethod<T>() using the... |
Are there any sites out there that have been built with asp.net and facebook api? I am looking for some ideas and inspiration for doing some social networking web programming. I did find some asp.net/facebook blog entries but still could not find any site that has successfuly done some work in this area.
| There are many websites and projects that have successfully integrated ASP.NET with the Facebook API. Here are some examples and ideas that might inspire your social networking web programming:
### 1. **Social Authentication**
- **Idea**: Implement social login using Facebook, allowing users to sign in with their F... | 42,660 | [
{
"from": "human",
"value": "Are there any sites out there that have been built with asp.net and facebook api? I am looking for some ideas and inspiration for doing some social networking web programming. I did find some asp.net/facebook blog entries but still could not find any site that has successfuly do... |
We've added performance measures to our application and are exposing them using
JMX. Now we would like to gather and store performance data for analysis, in files or in a database.
Does anyone know of a JMX client, open source or commercial, that can persist gathered information?
| Yes, there are several JMX clients and tools that can gather, store, and analyze performance data exposed via JMX. Here are some options, both open-source and commercial, that you can consider:
### Open Source Tools
1. **JConsole**: This is a graphical monitoring tool that comes with the JDK. It allows you to connect... | 41,359 | [
{
"from": "human",
"value": "We've added performance measures to our application and are exposing them using\nJMX. Now we would like to gather and store performance data for analysis, in files or in a database.\nDoes anyone know of a JMX client, open source or commercial, that can persist gathered informati... |
How can I create a JButton in Swing with the icon above the text?
| In Swing, you can create a `JButton` with an icon above the text by using the `setVerticalTextPosition` and `setHorizontalTextPosition` methods of the `JButton` class. Here’s a step-by-step guide on how to do this:
1. Create a `JButton` object.
2. Set the icon using the `setIcon` method.
3. Set the text of the button ... | 43,610 | [
{
"from": "human",
"value": "How can I create a JButton in Swing with the icon above the text?\n"
},
{
"from": "gpt",
"value": "In Swing, you can create a `JButton` with an icon above the text by using the `setVerticalTextPosition` and `setHorizontalTextPosition` methods of the `JButton` class. ... |
The title pretty much says it all. :-) I have lots of virtual hosts and I want to put a single rewriting block at the top of the httpd.conf file that rewrites URLs no matter which virtual host the request might be directed to. How the heck do I do this?
I found this but my question is the same: how can I do this wit... | To set up URL rewriting for all virtual hosts in your Apache configuration without using `.htaccess` files, you can create a rewrite rule in the main server configuration block (outside of the individual virtual host blocks) or in a specific context that encompasses all virtual hosts.
However, to effectively manage th... | 41,449 | [
{
"from": "human",
"value": "The title pretty much says it all. :-) I have lots of virtual hosts and I want to put a single rewriting block at the top of the httpd.conf file that rewrites URLs no matter which virtual host the request might be directed to. How the heck do I do this?\nI found this but my q... |
I remember reading a how-to book several years ago, about Use Cases. (This was probably before user stories supplanted this part of the terminology.)
The task at hand was something like adding new customers.
There was roughly a 1-page offset section that described a couple developers who said something like "We don't n... | The scenario you're describing sounds reminiscent of various anecdotal tales that highlight the importance of thorough requirements gathering and use cases in software development. While I can't pinpoint a specific book that matches your description exactly, it does bear similarities to common narratives found in liter... | 48,672 | [
{
"from": "human",
"value": "I remember reading a how-to book several years ago, about Use Cases. (This was probably before user stories supplanted this part of the terminology.)\nThe task at hand was something like adding new customers.\nThere was roughly a 1-page offset section that described a couple dev... |
Working with Microsoft SQL Server I found extremely useful SQL Server Profiler and Estimated Execution Plan (available in Management Studio) to optimize queries during development and production system monitoring.
Are there similar tools (open source or commercial) or techniques available for MySQL?
| Yes, MySQL offers several tools and techniques similar to SQL Server Profiler and Estimated Execution Plan for monitoring and optimizing queries. Here are some options:
### Tools
1. **MySQL Workbench**:
- MySQL Workbench includes a visual query builder and an execution plan viewer. You can analyze and optimize you... | 41,485 | [
{
"from": "human",
"value": "Working with Microsoft SQL Server I found extremely useful SQL Server Profiler and Estimated Execution Plan (available in Management Studio) to optimize queries during development and production system monitoring.\nAre there similar tools (open source or commercial) or technique... |
I'm trying to use MySQL to create a view with the "WITH" clause
WITH authorRating(aname, rating) AS
SELECT aname, AVG(quantity)
FROM book
GROUP BY aname
But it doesn't seem like MySQL supports this.
I thought this was pretty standard and I'm sure Oracle supports this. Is there anyway to force MySQL to use the... | As of MySQL version 8.0, the `WITH` clause (also known as Common Table Expressions or CTEs) is indeed supported. If you are using a version of MySQL that is earlier than 8.0, you will not be able to use the `WITH` clause for creating views or for any other purpose. If you are using MySQL 8.0 or later, you can use the `... | 40,970 | [
{
"from": "human",
"value": "I'm trying to use MySQL to create a view with the \"WITH\" clause\nWITH authorRating(aname, rating) AS\n SELECT aname, AVG(quantity)\n FROM book\n GROUP BY aname\n\nBut it doesn't seem like MySQL supports this.\nI thought this was pretty standard and I'm sure Oracle suppor... |
I feel like an idiot asking this...
Table 1: users
id serial
person integer
username char(32)
Table 2:persons
id serial
name char(16)
Can I run a query that returns the name field in persons by providing the username in users?
users
1 | 1 | larry123
persons
1 | larry
2 | curly
SQL?
select name from persons where ... | You're on the right track! To retrieve the `name` from the `persons` table based on a given `username` from the `users` table, you'll want to use a JOIN to combine the two tables in a single query. Here's how you can do that:
```sql
SELECT p.name
FROM users u
JOIN persons p ON u.person = p.id
WHERE u.username = 'lar... | 46,918 | [
{
"from": "human",
"value": "I feel like an idiot asking this...\n\nTable 1: users\nid serial\nperson integer\nusername char(32)\n\nTable 2:persons\nid serial\nname char(16)\n\nCan I run a query that returns the name field in persons by providing the username in users?\n\nusers\n1 | 1 | larry123\n\npersons\... |
I am looking for a way to quickly compare the state of a database table with the results of a Web service call.
I need to make sure that all records returned by the Web service call exist in the database, and any records in the database that are no longer in the Web service response are removed from the table.
I have t... | To tackle the problem of comparing a data structure with the results of a database table and synchronizing them efficiently, let's break it down into your two main questions.
### 1. Comparing the Data Structure with Database Records
Using an MD5 hash is a reasonable approach for quick comparisons if the data structur... | 42,799 | [
{
"from": "human",
"value": "I am looking for a way to quickly compare the state of a database table with the results of a Web service call.\nI need to make sure that all records returned by the Web service call exist in the database, and any records in the database that are no longer in the Web service res... |
I use Intellij Idea 7 for Java dev. My dev is 'limited' to all J2SE features plus light JSP, Servlets, and super light usage of JPA. No J2EE, no massive use of random frameworks, etc.
Is it worth upgrading to ver 8? "Worth it" to me means better "core functionality" in terms of speed (ESPECIALLY startup speed), memor... | Upgrading from IntelliJ IDEA 7 to 8 can have several potential benefits, particularly in terms of performance and core functionality, but whether it is "worth it" for your specific needs depends on a few factors. Here are some points to consider:
1. **Performance Improvements**: IntelliJ IDEA 8 introduced a number of ... | 44,394 | [
{
"from": "human",
"value": "I use Intellij Idea 7 for Java dev. My dev is 'limited' to all J2SE features plus light JSP, Servlets, and super light usage of JPA. No J2EE, no massive use of random frameworks, etc.\nIs it worth upgrading to ver 8? \"Worth it\" to me means better \"core functionality\" in te... |
I'm working with SQL Server 2005 and Windows Server 2000 and wonder if there are any 'automated' ways of blocking SQL Injection attacks while I shore up my code.
Some have suggested that there are ways to:
Put in some kind of ISAPI or HTTP module that filters request post and querystrings for injection-oriented symbol... | Dealing with SQL Injection vulnerabilities, especially in older environments like SQL Server 2005 and Windows Server 2000, can be challenging. Here are some strategies you can consider for minimizing the risk of SQL Injection attacks while you work on improving your code:
### 1. Use Parameterized Queries
While you men... | 43,041 | [
{
"from": "human",
"value": "I'm working with SQL Server 2005 and Windows Server 2000 and wonder if there are any 'automated' ways of blocking SQL Injection attacks while I shore up my code.\nSome have suggested that there are ways to:\n\nPut in some kind of ISAPI or HTTP module that filters request post an... |
I'd like to put in an UIButton in the center of the navigation bar. Based on the document, it appears I need to set title view, and make sure the leftBarButtonItem is nil. But it is not work for me. Here is the code.
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setTitle:@"List" forState:UICon... | It looks like you're trying to add a UIButton in the center of the navigation bar using `titleView`. However, you're not correctly assigning the UIButton to the `titleView` of the navigation item. Instead of adding the button as a subview of the `titleView`, you should set the `titleView` property directly to the butto... | 45,014 | [
{
"from": "human",
"value": "I'd like to put in an UIButton in the center of the navigation bar. Based on the document, it appears I need to set title view, and make sure the leftBarButtonItem is nil. But it is not work for me. Here is the code.\nUIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedR... |
Please list one site which allows Flash/Silverlight access via crossdomain.xml file. Vote for your favorite sites.
The goal is to build an up to date list of sites which can be directly accessed via Flash/Silverlight without a server-side proxy.
| One site that allows Flash/Silverlight access via a crossdomain.xml file is **Adobe's own website** for Flash content. Adobe typically provides a crossdomain.xml file that allows Flash applications hosted on other domains to access their resources.
However, it's important to note that both Flash and Silverlight have b... | 46,630 | [
{
"from": "human",
"value": "Please list one site which allows Flash/Silverlight access via crossdomain.xml file. Vote for your favorite sites.\nThe goal is to build an up to date list of sites which can be directly accessed via Flash/Silverlight without a server-side proxy. \n"
},
{
"from": "gpt",
... |
I have a batch file that does this.
ECHO A41,35,0,a,1,1,N,"Mr ZACHARY KAPLAN">> test.txt
There are about 30k similar lines. It takes the batch file about 5 hours to run.
Is there a way to speed this up?
/Jeanre
| Yes, there are several strategies you can employ to speed up the process of writing lines to a file in a batch script. Here are some approaches:
1. **Batch Processing**: Instead of writing each line one by one in a loop, you can collect all lines into a variable and write them to the file in one go. This minimizes the... | 44,350 | [
{
"from": "human",
"value": "I have a batch file that does this.\nECHO A41,35,0,a,1,1,N,\"Mr ZACHARY KAPLAN\">> test.txt \nThere are about 30k similar lines. It takes the batch file about 5 hours to run. \nIs there a way to speed this up?\n/Jeanre\n"
},
{
"from": "gpt",
"value": "Yes, there are ... |
Does cygwin allow a statically compiled binary? This would prevent the need for cygwin1.dll being on the PATH of target machines.
| Cygwin is designed to provide a POSIX-compatible environment on Windows, and it relies on the `cygwin1.dll` dynamic link library to provide compatibility for POSIX APIs. Because of this reliance on the Cygwin DLL, it is not possible to create truly statically linked binaries that would completely eliminate the need for... | 47,683 | [
{
"from": "human",
"value": "Does cygwin allow a statically compiled binary? This would prevent the need for cygwin1.dll being on the PATH of target machines.\n"
},
{
"from": "gpt",
"value": "Cygwin is designed to provide a POSIX-compatible environment on Windows, and it relies on the `cygwin1.d... |
I am writing a Cocoa application with Mono embedded. I want to run and see my debug output in Terminal. On the Cocoa side I am using NSLog(), and on the Mono side I am using Debug.Write(). I can see my debug output in Xcode's console, but not in Terminal. This is what I tried:
$: open /path/build/Debug/MyProgram.... | To redirect the output of your Cocoa application running from Terminal to a file, you need to use the command in a way that captures both standard output (stdout) and standard error (stderr). The `open` command launches the app in a separate process, which means that its output is not redirected to your terminal sessio... | 45,043 | [
{
"from": "human",
"value": "I am writing a Cocoa application with Mono embedded. I want to run and see my debug output in Terminal. On the Cocoa side I am using NSLog(), and on the Mono side I am using Debug.Write(). I can see my debug output in Xcode's console, but not in Terminal. This is what I tried... |
I have the following in a page e.g. /mypage?myvar=oldvalue
$_SESSION['myvar'] = $_GET['myvar'];
$myvar = 'a_new_string'
Now $_SESSION['myvar'] has the value 'a_new_string'
Is this by design?
How can I copy the value of 'myvar' rather than a reference to it?
| In your scenario, you have the following lines of code:
```php
$_SESSION['myvar'] = $_GET['myvar'];
$myvar = 'a_new_string';
```
The value of `$_SESSION['myvar']` is being set to the value of `$_GET['myvar']` which is `'oldvalue'`, but later you set `$myvar` to `'a_new_string'`. The line that assigns to `$_SESSION['m... | 44,481 | [
{
"from": "human",
"value": "I have the following in a page e.g. /mypage?myvar=oldvalue\n$_SESSION['myvar'] = $_GET['myvar'];\n$myvar = 'a_new_string'\n\nNow $_SESSION['myvar'] has the value 'a_new_string'\nIs this by design?\nHow can I copy the value of 'myvar' rather than a reference to it?\n"
},
{
... |
I have a project that uses a class library for the business layer functionality (database access, etc.). A web application sits on top of this. I have a web service that I would like to call in the class library. Every time I add a 'service reference' (I am using VS2008) to the class library, everything seems to work O... | It sounds like you are trying to access a web service from within your class library, but you're encountering issues with the generated classes and names when you add the service reference. Here's how you can properly consume your web service from the class library and access it effectively.
### Step-by-Step Guide
1.... | 43,223 | [
{
"from": "human",
"value": "I have a project that uses a class library for the business layer functionality (database access, etc.). A web application sits on top of this. I have a web service that I would like to call in the class library. Every time I add a 'service reference' (I am using VS2008) to the ... |
I wrote a while loop in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it?
def determine_period(universe_array):
period=0
tmp=universe_array
while True:
tmp=apply_rules(tmp)#aplly_rules is a another function
peri... | It looks like you're trying to prevent an infinite loop by checking if the `period` exceeds 12 after the loop finishes. However, since you have a `break` statement inside the loop that only exits when `numpy.array_equal(tmp, universe_array)` is `True`, the condition for exiting the loop doesn't account for the `period`... | 44,997 | [
{
"from": "human",
"value": "I wrote a while loop in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it?\ndef determine_period(universe_array):\n period=0\n tmp=universe_array\n while True:\n tmp=apply_rules(tmp)#... |
Presently I'm starting to introduce the concept of Mock objects into my Unit Tests. In particular I'm using the Moq framework. However, one of the things I've noticed is that suddenly the classes I'm testing using this framework are showing code coverage of 0%.
Now I understand that since I'm just mocking the class, it... | When using Mock objects to test your code, the primary purpose is to isolate the behavior of the class under test by replacing its dependencies with mock implementations. However, in your example, you're trying to mock the class `MyClass` itself, which doesn't achieve the goal of testing the class. Instead, it results ... | 40,811 | [
{
"from": "human",
"value": "Presently I'm starting to introduce the concept of Mock objects into my Unit Tests. In particular I'm using the Moq framework. However, one of the things I've noticed is that suddenly the classes I'm testing using this framework are showing code coverage of 0%.\nNow I understand... |
How do I create a view dynamically in SQL Server using C#?
| Creating a dynamic SQL view in SQL Server using C# involves a few steps. You'll typically create a SQL command string that contains the SQL to create the view, and then execute that command against the database using ADO.NET. Here’s how you can do this:
### Steps to Create a Dynamic View in SQL Server Using C#
1. **E... | 41,924 | [
{
"from": "human",
"value": "How do I create a view dynamically in SQL Server using C#?\n"
},
{
"from": "gpt",
"value": "Creating a dynamic SQL view in SQL Server using C# involves a few steps. You'll typically create a SQL command string that contains the SQL to create the view, and then execut... |
Why VS does not have support for undo/redo files?
| Visual Studio (VS) does have some support for undo/redo functionality, but this feature primarily operates within the context of the code editor itself rather than file-level operations. Here are some key points to consider regarding undo/redo functionality in Visual Studio:
1. **Code Editor**: When you're editing cod... | 45,514 | [
{
"from": "human",
"value": "Why VS does not have support for undo/redo files?\n"
},
{
"from": "gpt",
"value": "Visual Studio (VS) does have some support for undo/redo functionality, but this feature primarily operates within the context of the code editor itself rather than file-level operation... |
For this dropdownlist in HTML:
<select id="countries">
<option value="1">Country</option>
</select>
I would like to open the list (the same as left-clicking on it). Is this possible using JavaScript (or more specifically jQuery)?
| Yes, you can programmatically open a dropdown list using JavaScript or jQuery by triggering a focus event followed by a click on the dropdown. However, note that browser behavior may vary, and it might not always result in the dropdown appearing if the browser doesn't allow it for security reasons.
Here's an example o... | 45,106 | [
{
"from": "human",
"value": "For this dropdownlist in HTML:\n<select id=\"countries\">\n<option value=\"1\">Country</option>\n</select>\n\nI would like to open the list (the same as left-clicking on it). Is this possible using JavaScript (or more specifically jQuery)?\n"
},
{
"from": "gpt",
"val... |
Where can i get c++ standard manual?
Is that free?
DUPLICATE: Where can I look at the C++ standard
| You can access the C++ standard for free from several sources. Here are a few options:
1. **ISO C++ Website**: The official website for the C++ standard (ISO/IEC 14882) often has drafts of the standard available for free. You can check out the latest draft (currently for C++20 or C++23, depending on when you're lookin... | 46,854 | [
{
"from": "human",
"value": "Where can i get c++ standard manual?\nIs that free?\nDUPLICATE: Where can I look at the C++ standard\n"
},
{
"from": "gpt",
"value": "You can access the C++ standard for free from several sources. Here are a few options:\n\n1. **ISO C++ Website**: The official websit... |
I've read a little bit about unit testing and was wondering how YOU unit test. Apparently unit testing is supposed to break a program down into very small "units" and test functionality from there.
But I'm wondering, is it enough to unit test a class? Or do you take it even further and unit test algorithms, formulas,... | Unit testing is a fundamental practice in software development that involves testing individual components or "units" of code to ensure that they function correctly. Here's a breakdown of how to approach unit testing, including your specific questions:
### 1. **What to Unit Test**
- **Classes and Methods:** Unit test... | 40,534 | [
{
"from": "human",
"value": "I've read a little bit about unit testing and was wondering how YOU unit test. Apparently unit testing is supposed to break a program down into very small \"units\" and test functionality from there.\nBut I'm wondering, is it enough to unit test a class? Or do you take it even... |
I am trying to do something like this
public void GetData(ref Dictionary<T,V> dataDictionary)
{
}
Where T can be GUID, string, or int and V is custom user or item object.
| In C#, you can achieve this by using generics. You can create a generic method that accepts a `Dictionary` with type parameters for both the key and value types. Here's how you can define your `GetData` method to accept a dictionary where `T` can be `Guid`, `string`, or `int`, and `V` is a custom user or item object:
... | 39,574 | [
{
"from": "human",
"value": "I am trying to do something like this\npublic void GetData(ref Dictionary<T,V> dataDictionary)\n{\n\n\n}\n\nWhere T can be GUID, string, or int and V is custom user or item object.\n"
},
{
"from": "gpt",
"value": "In C#, you can achieve this by using generics. You ca... |
I'm interested in developing applications on the iPhone and being a .NET & ActionScript developer I'm a bit scared from the learning curve of Objective-C Cocoa Touch programming. I know that Adobe has Flash player ready for iPhone and I think that Apple doesn't want it just for political reason. Is there any easy alt... | If you're looking to develop iPhone applications without diving deep into Objective-C and Cocoa Touch, you have several alternative options:
1. **Swift**: Although Swift is a language created by Apple and has similarities to Objective-C, many developers find it easier to learn. Swift is designed to be more approachabl... | 45,395 | [
{
"from": "human",
"value": "I'm interested in developing applications on the iPhone and being a .NET & ActionScript developer I'm a bit scared from the learning curve of Objective-C Cocoa Touch programming. I know that Adobe has Flash player ready for iPhone and I think that Apple doesn't want it just for... |
I've been interested in doing some work on a desktop application for while now and my most proficient language is Java. Due to wanting to be able to compile down to a native executable, does anyone have any experience they would like to share about using gcj to compile, and CNI for libraries? I was hoping to use of of ... | Using the GNU Compiler for Java (gcj) is an interesting approach for compiling Java applications to native executables, but it's important to note that as of GCC 5 (released in 2015), gcj has been deprecated and is no longer actively maintained. This means you might encounter limitations or lack of support for newer Ja... | 43,607 | [
{
"from": "human",
"value": "I've been interested in doing some work on a desktop application for while now and my most proficient language is Java. Due to wanting to be able to compile down to a native executable, does anyone have any experience they would like to share about using gcj to compile, and CNI ... |
I got a web application, the problem is that the text in the label will not update on the first click, I need to click the button twice, I debugged to code, and I found out that the label does not recive the data until after the second click,
Here is my code:
System.Data.SqlClient.SqlCommand command = new System.Data.S... | Based on your description of the problem and the provided code, it seems that the issue is related to the page lifecycle in ASP.NET Web Forms and how the controls are being updated. Specifically, the `Page_Load` event is being called before the `btnFilter_Click` event, which means that the `labDownloadList` label is be... | 40,765 | [
{
"from": "human",
"value": "I got a web application, the problem is that the text in the label will not update on the first click, I need to click the button twice, I debugged to code, and I found out that the label does not recive the data until after the second click,\nHere is my code:\nSystem.Data.SqlCl... |
Control.TabIndex
Only allows me to overide the Tab order of controls in a given container.
Is there a way to specify this across all the controls in, for example a UserControl, regardless of the contains used to arrange the controls.
Cheers,
Jan
| In Windows Forms (WinForms), the `TabIndex` property determines the order in which controls receive focus when the user navigates through them using the Tab key. However, by default, the `TabIndex` only applies to controls within the same container (like a `Panel`, `GroupBox`, or `UserControl`). If you want to control ... | 43,377 | [
{
"from": "human",
"value": "Control.TabIndex\n\nOnly allows me to overide the Tab order of controls in a given container. \nIs there a way to specify this across all the controls in, for example a UserControl, regardless of the contains used to arrange the controls.\nCheers,\nJan\n"
},
{
"from": "g... |
I'm currently creating a window system for XNA games from scratch. I'm developing primarily for Windows, but who knows what platforms I might support in the future. Feel free to answer if you know this for native Direct3D, since the performance semantics should be similar. If possible, consider what would change if the... | Creating an efficient window system for XNA games is an interesting challenge, especially when considering the various approaches for rendering controls and managing their states and animations. Let's break down your questions and recommendations for your approaches:
### Recommended Approach
Given the options you out... | 42,577 | [
{
"from": "human",
"value": "I'm currently creating a window system for XNA games from scratch. I'm developing primarily for Windows, but who knows what platforms I might support in the future. Feel free to answer if you know this for native Direct3D, since the performance semantics should be similar. If po... |
I am currently working in C#, and I need to insert a new record into one table, get the new primary key value, and then use that as a foreign key reference in inserting several more records. The Database is MS SQL Server 2003. All help is appreciated!
| Inserting a new record into a SQL Server database and retrieving the newly generated primary key is a common task in C#. You can accomplish this by using ADO.NET and the `OUTPUT INSERTED` clause in your SQL statement. Below is a step-by-step guide, including an example.
### Step-by-Step Guide
1. **Insert the Record**... | 41,798 | [
{
"from": "human",
"value": "I am currently working in C#, and I need to insert a new record into one table, get the new primary key value, and then use that as a foreign key reference in inserting several more records. The Database is MS SQL Server 2003. All help is appreciated!\n"
},
{
"from": "gp... |
I am using an ancient version of Oracle (8.something) and my ADO.NET application needs to do some fairly large transactions. Large enough to not fin in our small rollback segments. Now we have a large rollback segment as well but it is not used by default.
Oracle has a command to select the rollback segment to be used ... | Working with older versions of Oracle, such as Oracle 8, can be challenging, especially when dealing with large transactions and rollback segments. The restriction that `SET TRANSACTION USE ROLLBACK SEGMENT` must be the first command executed within a transaction makes it tricky when using ADO.NET, which may automatica... | 42,318 | [
{
"from": "human",
"value": "I am using an ancient version of Oracle (8.something) and my ADO.NET application needs to do some fairly large transactions. Large enough to not fin in our small rollback segments. Now we have a large rollback segment as well but it is not used by default.\nOracle has a command ... |
For example, I have a pet table and a lost pets table. I want to get all of the pets that are NOT lost with 1 join and no sub-selects. Is that possible? A typical join only returns results that are in both tables.
| Yes, it is possible to get all pets that are not lost using a `LEFT JOIN` combined with a `WHERE` clause that checks for `NULL` values in the lost pets table. Here’s how you can do it:
Assuming you have two tables:
- `pets`: which contains all pets
- `lost_pets`: which contains pets that have been reported lost
You ... | 48,037 | [
{
"from": "human",
"value": "For example, I have a pet table and a lost pets table. I want to get all of the pets that are NOT lost with 1 join and no sub-selects. Is that possible? A typical join only returns results that are in both tables.\n"
},
{
"from": "gpt",
"value": "Yes, it is possible ... |
I need to create several applications that all share a Microsoft SQL Server database. These include ASP.NET web applications, WPF desktop applications, and probably the odd console app every now and then.
I'd like to use the ADO.NET Entity Framework for data access, extend its objects for my business logic, and bind t... | To create a set of applications that share a Microsoft SQL Server database while using ADO.NET Entity Framework, you can adopt a layered architecture that promotes code reusability, separation of concerns, and maintainability. Here's a suggested architecture along with answers to your follow-up questions.
### Suggeste... | 38,927 | [
{
"from": "human",
"value": "I need to create several applications that all share a Microsoft SQL Server database. These include ASP.NET web applications, WPF desktop applications, and probably the odd console app every now and then.\nI'd like to use the ADO.NET Entity Framework for data access, extend its... |
I'm writing a program that creates a Word document with sensitive information. I'd like to encrypt and password protect the document and distribute it in a self-extracting file so that the user can double-click, provide a password, and then receive the unencrypted file.
I'm okay creating the Word document, but I'd like... | Certainly! You can achieve your goal using a combination of tools. Here's a step-by-step approach to encrypt your Word document, password-protect it, and then package it into a self-extracting archive.
### Step 1: Encrypt and Password-Protect the Word Document
For encrypting and password-protecting the Word document,... | 41,059 | [
{
"from": "human",
"value": "I'm writing a program that creates a Word document with sensitive information. I'd like to encrypt and password protect the document and distribute it in a self-extracting file so that the user can double-click, provide a password, and then receive the unencrypted file.\nI'm oka... |
Like the title says, how can I remove GAC assembly file using vbscript?
| To remove an assembly from the Global Assembly Cache (GAC) using VBScript, you can utilize the `gacutil` tool, which is part of the .NET SDK. This is a command-line tool and cannot be directly executed within VBScript by calling a function, but you can run shell commands from VBScript.
Here is a step-by-step guide on ... | 45,083 | [
{
"from": "human",
"value": "Like the title says, how can I remove GAC assembly file using vbscript?\n"
},
{
"from": "gpt",
"value": "To remove an assembly from the Global Assembly Cache (GAC) using VBScript, you can utilize the `gacutil` tool, which is part of the .NET SDK. This is a command-li... |
I am iterating over a list and I want to print out the index of the item if it meets a certain condition. How would I do this?
Example:
testlist = [1,2,3,5,3,1,2,1,6]
for item in testlist:
if item == 1:
print position
| To print the index of items in a list that meet a certain condition, you can use the `enumerate` function, which allows you to loop over both the index and the value of the items in the list simultaneously. Here’s how you can modify your code:
```python
testlist = [1, 2, 3, 5, 3, 1, 2, 1, 6]
for index, item in enumera... | 45,054 | [
{
"from": "human",
"value": "I am iterating over a list and I want to print out the index of the item if it meets a certain condition. How would I do this?\nExample: \ntestlist = [1,2,3,5,3,1,2,1,6]\nfor item in testlist:\n if item == 1:\n print position\n\n"
},
{
"from": "gpt",
"valu... |
I find a lot of use for matlab, but my current employer don't have a matlab license: there is one for Comsol, which comes with comsol Script. On a first glance, comsol script is identical to matlab, but after awhile you find eerie differences. Many graphics graphics' features are not there, and you can't export figures... | Yes, there are indeed differences between MATLAB and COMSOL Script, both in terms of core functionality and how they handle memory and matrix computations. Here are some key distinctions:
### 1. **Purpose and Design Philosophy**
- **MATLAB**: MATLAB is specifically designed for numerical computing and provides extensi... | 42,952 | [
{
"from": "human",
"value": "I find a lot of use for matlab, but my current employer don't have a matlab license: there is one for Comsol, which comes with comsol Script. On a first glance, comsol script is identical to matlab, but after awhile you find eerie differences. Many graphics graphics' features ar... |
this is not a primary key, but merely used as a marker in existing system that marks these items with a 1 letter code ie 'N' for new, 'R' for return, etc. I was going to go with a varchar(50) as the data type but wondering if there's anything wrong with say varchar(2) instead aiming for efficiency. thx!
| Using `VARCHAR(2)` for your letter code markers is a reasonable and efficient choice, especially since you are only storing single-letter codes such as 'N' for new, 'R' for return, etc. Here are some points to consider:
1. **Space Efficiency**: `VARCHAR(2)` will save space compared to `VARCHAR(50)`, especially if you ... | 44,374 | [
{
"from": "human",
"value": "this is not a primary key, but merely used as a marker in existing system that marks these items with a 1 letter code ie 'N' for new, 'R' for return, etc. I was going to go with a varchar(50) as the data type but wondering if there's anything wrong with say varchar(2) instead ai... |
I want to automate tests on my web application, and it uses postgresql. Does anyone know how define a restore point on a postgresql database and restore to an earlier state?
I heard something about point in time recovery, but i dont if this is what i need.
Thanks in advance
| Yes, you can use Point-In-Time Recovery (PITR) in PostgreSQL to restore your database to a specific point in time. This is particularly useful for testing scenarios where you want to reset your database to a known state before running your automated tests. Here’s a general outline of how you can set this up:
### Step ... | 40,492 | [
{
"from": "human",
"value": "I want to automate tests on my web application, and it uses postgresql. Does anyone know how define a restore point on a postgresql database and restore to an earlier state?\nI heard something about point in time recovery, but i dont if this is what i need.\nThanks in advance\n"... |
One thing that annoys me when debugging programs in Visual Studio (2005 in my case) is that when I use "step over" (by pressing F10) to execute to the next line of code, I often end up reaching that particular line of code in a totally different thread than the one I was looking at. This means that all the context of w... | Debugging multi-threaded applications can be challenging, especially in older versions of Visual Studio like 2005, where the tools for managing threads might not be as advanced as in later versions. Here are several strategies you can use to help manage your debugging experience, both in Visual Studio 2005 and in later... | 41,678 | [
{
"from": "human",
"value": "One thing that annoys me when debugging programs in Visual Studio (2005 in my case) is that when I use \"step over\" (by pressing F10) to execute to the next line of code, I often end up reaching that particular line of code in a totally different thread than the one I was looki... |
I need to validate an XML agaist a schema.
I tried XML::SAX::ParserFactory; XML::Validator::Schema and related modules but looks like they are limited.
Limited in the sense that it didn't recognize schema elements such as xsd:unique, xsd:group, xsd:keyref, xsd:union and xsd:key.
Are these xsd:unique, etc. new addit... | It seems that you are encountering limitations with the XML validation libraries in Perl. The `XML::Validator::Schema` module, while useful, might not fully support all of the complex features of XML Schema (XSD) such as `xsd:unique`, `xsd:key`, `xsd:keyref`, and `xsd:group`.
These constructs are part of the XSD 1.0 s... | 44,509 | [
{
"from": "human",
"value": "I need to validate an XML agaist a schema. \nI tried XML::SAX::ParserFactory; XML::Validator::Schema and related modules but looks like they are limited.\nLimited in the sense that it didn't recognize schema elements such as xsd:unique, xsd:group, xsd:keyref, xsd:union and xsd:... |
I can follow most of Apple's WiTap sample, but am sort of stumped on this bit in the send method:
- (void) send:(const uint8_t)message
{
if (_outStream && [_outStream hasSpaceAvailable])
if([_outStream write:(const uint8_t *)&message maxLength:sizeof(const uint8_t)] == -1)
[self _showAlert:@"Failed sending ... | You're asking some good questions, and it’s perfectly normal to feel puzzled when encountering bitwise operations for the first time. Let’s break down the purpose of the bitwise operations in the context of your code and clarify why they might be used.
### Understanding the Bitwise Operations
1. **Bitwise OR (`|`) an... | 42,567 | [
{
"from": "human",
"value": "I can follow most of Apple's WiTap sample, but am sort of stumped on this bit in the send method:\n- (void) send:(const uint8_t)message\n{\nif (_outStream && [_outStream hasSpaceAvailable])\n if([_outStream write:(const uint8_t *)&message maxLength:sizeof(const uint8_t)] == -... |
Given that I only have one monitor, what's the best way to debug a program which uses the entire screen (such as a DirectX application)? Tools such as the step-by-step debugger seem useless in this context. Also, printing to the console isn't as effective, since you can only look at the console once the application has... | Debugging a full-screen application, such as a DirectX application, can indeed be challenging when you're restricted to a single monitor. However, there are several strategies you can employ to make the debugging process more manageable:
### 1. Use Windowed Mode for Development
If possible, modify your application to ... | 42,178 | [
{
"from": "human",
"value": "Given that I only have one monitor, what's the best way to debug a program which uses the entire screen (such as a DirectX application)? Tools such as the step-by-step debugger seem useless in this context. Also, printing to the console isn't as effective, since you can only loo... |
I am using Zend Framework(MVC part of it), and need to either redirect user to SSL enabled page or to force SSL from controller somehow and don't quite see how to do that? Maybe someone can share the knowledge?
Thanks!
| To enforce SSL in a Zend Framework application, you can handle this in your controller or by utilizing the `Zend_Controller_Plugin_Abstract` to create a plugin that checks for HTTPS and redirects the user if needed.
Here's a step-by-step guide on how to implement SSL redirection:
### Method 1: Redirecting in the Cont... | 40,690 | [
{
"from": "human",
"value": "I am using Zend Framework(MVC part of it), and need to either redirect user to SSL enabled page or to force SSL from controller somehow and don't quite see how to do that? Maybe someone can share the knowledge? \nThanks!\n"
},
{
"from": "gpt",
"value": "To enforce SS... |
I've been thinking lately, would it be a good form of syntactic sugar in languages like Java and C#, to include a "duck" type as a method parameter type? This would look as follows:
void myFunction(duck foo) {
foo.doStuff();
}
This could be syntactic sugar for invoking doStuff() via reflection, or it could be impl... | The idea of introducing a "duck" type parameter in statically typed languages like Java and C# is indeed an interesting one. It blends concepts of static typing and dynamic behavior by allowing methods to accept any object that has a specified method, rather than being constrained to a fixed interface. Here are some po... | 43,671 | [
{
"from": "human",
"value": "I've been thinking lately, would it be a good form of syntactic sugar in languages like Java and C#, to include a \"duck\" type as a method parameter type? This would look as follows:\nvoid myFunction(duck foo) {\n foo.doStuff();\n}\n\nThis could be syntactic sugar for invoki... |
I have set up transactional replication between two SQL Servers on different ends of a relatively slow VPN connection. The setup is your standard "load snapshot immediately" kind of thing where the first thing it does after initializing the subscription is to drop and recreate all tables on the subscriber side and the... | Setting up transactional replication over a slow VPN connection can be challenging, especially with large tables. Here are some strategies you can use to address the issues you're facing with the BCP process and explore alternative approaches:
### Improving the Current Setup
1. **Increase Timeout Settings**:
- Yo... | 41,506 | [
{
"from": "human",
"value": "I have set up transactional replication between two SQL Servers on different ends of a relatively slow VPN connection. The setup is your standard \"load snapshot immediately\" kind of thing where the first thing it does after initializing the subscription is to drop and recreat... |
I implemented OpenID support for an ASP.Net 2.0 web application and everything seems to be working fine on my local machine.
I am using DotNetOpenId library. Before I redirect to the third party website I store the orginal OpenID in the session to use when the user is authenticated (standard practice I believe).
Howeve... | Yes, switching from `mysite.com` to `www.mysite.com` can cause issues with session management, primarily because cookies are domain-specific. In the case of ASP.NET, when you set a session cookie, it is set for the domain of the request. Therefore, if you access the site using `mysite.com`, the session cookie is create... | 40,872 | [
{
"from": "human",
"value": "I implemented OpenID support for an ASP.Net 2.0 web application and everything seems to be working fine on my local machine.\nI am using DotNetOpenId library. Before I redirect to the third party website I store the orginal OpenID in the session to use when the user is authentic... |
I would like such empty span tags (filled with and space) to be removed:
<span> </span>
I've tried with this regex, but it needs adjusting:
(<span>( |\s)*</span>)
preg_replace('#<span>( |\s)*</span>#si','<\\1>',$encoded);
| It looks like you're trying to remove `<span>` tags that only contain non-breaking spaces (` `) or whitespace characters. Your current regex needs a few adjustments to correctly match and replace those tags.
Here’s an updated version of your regex:
```php
$encoded = preg_replace('#<span>\s* \s* \s*&nbs... | 45,778 | [
{
"from": "human",
"value": "I would like such empty span tags (filled with and space) to be removed:\n<span> </span>\nI've tried with this regex, but it needs adjusting: \n(<span>( |\\s)*</span>)\npreg_replace('#<span>( |\\s)*</span>#si','<\\\\1>',$encoded);\n"
},
... |
I am giving link of a pdf file on my web page for download, like below
<a href="myfile.pdf">Download Brochure</a>
The problem is when user clicks on this link then
If the user have installed Adobe Acrobat, then it opens the file in the same browser window in Adobe Reader.
If the Adobe Acrobat is not installed then it... | To ensure that a PDF file always prompts the user to download rather than open in the browser or in a PDF reader, you can use the `Content-Disposition` header in your web server configuration or in a server-side script.
### Using Server Configuration:
1. **Apache Web Server**:
If you're using Apache, you can add... | 45,173 | [
{
"from": "human",
"value": "I am giving link of a pdf file on my web page for download, like below\n<a href=\"myfile.pdf\">Download Brochure</a>\n\nThe problem is when user clicks on this link then\n\nIf the user have installed Adobe Acrobat, then it opens the file in the same browser window in Adobe Reade... |
What's the best way to load HTML markup for a custom jQuery UI widget?
So far, I've seen elements simply created using strings (i.e. $(...).wrap('<div></div>')) which is fine for something simple. However, this makes it extremely difficult to modify later for more complex elements.
This seems like a fairly common probl... | When creating custom jQuery UI widgets, it's important to manage your HTML structure in a way that allows for easier modifications and maintenance. While using string-based markup with methods like `$(...).wrap('<div></div>')` is quick for simple cases, it can quickly become unwieldy for more complex widgets. Here are ... | 43,290 | [
{
"from": "human",
"value": "What's the best way to load HTML markup for a custom jQuery UI widget?\nSo far, I've seen elements simply created using strings (i.e. $(...).wrap('<div></div>')) which is fine for something simple. However, this makes it extremely difficult to modify later for more complex eleme... |
I have a legacy ASP application written in JScript. At the moment it uses its own database tables for user accounts and authentication. The customer data for this app is being moved into Microsoft Dynamics CRM 4.0, and I need to modify the ASP site's authentication to look up user credentials in Dynamics CRM instead.
H... | You've laid out some solid approaches for integrating Dynamics CRM authentication into your legacy ASP application. Let's break down each option along with some considerations and recommendations based on experience in similar migration projects.
### 1. **Rewrite the Login Pages as ASPX**
- **Pros:**
- Moving ... | 43,079 | [
{
"from": "human",
"value": "I have a legacy ASP application written in JScript. At the moment it uses its own database tables for user accounts and authentication. The customer data for this app is being moved into Microsoft Dynamics CRM 4.0, and I need to modify the ASP site's authentication to look up us... |
I'm reseting a sort column that has duplicate or missing values like so:
set @last='';
set @sort=NULL;
update conf_profile set sort=
if(
@last=(@last:=concat(org_id,',',profile_type_id,',',page,',',col)),
(@sort:=@sort+1),
(@sort:=0)
)
order by org_id,profile_type_id,page,col,sort,id;
(... | The behavior you're experiencing with your MySQL update query is likely related to how MySQL handles user-defined session variables in a single statement, especially in older versions like 5.0.51. In particular, in this version, the order of operations and the timing of when variables are evaluated can lead to unexpect... | 44,253 | [
{
"from": "human",
"value": "I'm reseting a sort column that has duplicate or missing values like so:\nset @last='';\nset @sort=NULL;\nupdate conf_profile set sort=\n if(\n @last=(@last:=concat(org_id,',',profile_type_id,',',page,',',col)),\n (@sort:=@sort+1),\n (@sort:=0)\n )\nor... |
Stupid questions but cant get my head around it...
I have a string in this format 20081119
And I have a C# method that converts the string to a DateTime to be entered into a SQL Server DB
public static DateTime MyDateConversion(string dateAsString)
{
return System.DateTime.ParseExact(dateAsString, "yyyyMM... | It looks like you are trying to convert a string representation of a date (in the format `yyyyMMdd`) to a `DateTime` object in C#. When you say you need it to be a `DateTime` of type `yyyyMMdd`, it’s important to clarify that `DateTime` inherently does not have a specific format. Instead, it represents a point in time.... | 40,677 | [
{
"from": "human",
"value": "Stupid questions but cant get my head around it...\nI have a string in this format 20081119\nAnd I have a C# method that converts the string to a DateTime to be entered into a SQL Server DB \npublic static DateTime MyDateConversion(string dateAsString)\n {\n\n return S... |
I've just finished a six hour debugging session for a weird UI effect where I found that my favorite framework's implementation of an interface function called "getVisibleRegion" disabled some UI feature (and apparently forgot to restore it).
I've filed a bug with the framework, but this made me think about proper des... | Your experience raises an important point about the design of APIs and the expectations around the behavior of methods, especially those that are named to suggest a "getter" behavior. In general, when designing an interface or an API, it's crucial to adhere to principles that help prevent confusion and unintended side ... | 43,617 | [
{
"from": "human",
"value": "I've just finished a six hour debugging session for a weird UI effect where I found that my favorite framework's implementation of an interface function called \"getVisibleRegion\" disabled some UI feature (and apparently forgot to restore it). \nI've filed a bug with the framew... |
In Apple's NSObject documentation, NSZoneFree is called in the - (void)dealloc example code:
- (void)dealloc {
[companion release];
NSZoneFree(private, [self zone])
[super dealloc];
}
You can find it in context over here.
I never had the notion that I should be calling NSZoneFree in my own NSObject subclas... | The use of `NSZoneFree` in your `dealloc` implementation is generally not something you need to worry about in most cases when developing with Objective-C. Here’s a clearer explanation regarding `NSZoneFree` and when you should use it:
1. **NSZones**: In Objective-C, NSZones are a way to manage memory more efficiently... | 44,380 | [
{
"from": "human",
"value": "In Apple's NSObject documentation, NSZoneFree is called in the - (void)dealloc example code:\n- (void)dealloc {\n [companion release];\n NSZoneFree(private, [self zone])\n [super dealloc];\n}\n\nYou can find it in context over here.\nI never had the notion that I should... |
in context of SQL Server 2005, I have a table for which the primary key is a uniqueidentifier (GUID), with a default value generated by the newid() function. I want to write a stored procedure that inserts a new record into the table. How do I get the record's PK value? for an identity-declared field, this is easy - I ... | In SQL Server, when you use a `uniqueidentifier` as a primary key with a default value generated by the `NEWID()` function, you don't have to worry about getting the value from the database after the insert. This is because `NEWID()` generates a new GUID value that is assigned as the default for the primary key column ... | 43,566 | [
{
"from": "human",
"value": "in context of SQL Server 2005, I have a table for which the primary key is a uniqueidentifier (GUID), with a default value generated by the newid() function. I want to write a stored procedure that inserts a new record into the table. How do I get the record's PK value? for an i... |
Profiling LINQ queries and their execution plans is especially important due to the crazy SQL that can sometimes be created.
I often find that I need to track a specific query and have a hard time finding in query analyzer. I often do this on a database which has a lot of running transactions (sometimes production ser... | Profiling LINQ queries and their generated SQL can indeed be challenging, especially in a production environment. Here are several approaches you might consider to improve your tracking of specific queries without the pitfalls you mentioned:
### 1. **SQL Server Extended Events**:
Instead of using SQL Server Profiler, ... | 42,834 | [
{
"from": "human",
"value": "Profiling LINQ queries and their execution plans is especially important due to the crazy SQL that can sometimes be created. \nI often find that I need to track a specific query and have a hard time finding in query analyzer. I often do this on a database which has a lot of runn... |
Given a table X and a view Y (that has the same structure as X) is there a way to rename X to Z and Y to X atomically so that no query will ever see nothing named X? Renaming X and creating the view would also be valid.
The point would be to, as part of a schema migration plan, replace the old tables with views that si... | To achieve an atomic rename of a table and a view (or vice versa) in MySQL and ensure that no query can see an object named `X` while transitioning to `Z` and `Y`, you can use a combination of temporary names and transactions. However, MySQL doesn't support truly atomic renames across multiple objects directly. Here's ... | 42,119 | [
{
"from": "human",
"value": "Given a table X and a view Y (that has the same structure as X) is there a way to rename X to Z and Y to X atomically so that no query will ever see nothing named X? Renaming X and creating the view would also be valid.\nThe point would be to, as part of a schema migration plan,... |
There seems to be three common approaches for mapping an application end user to a database user.
One to One Mapping: Each Application user (bob, nancy and fred) also get a corresponding database user account (bob nancy and fred).
N to M mapping: Each application user is mapped to a database user that represents t... | You're right to point out the different approaches for mapping application end users to database users, and you bring up some valid observations regarding why the N-to-1 mapping approach is often favored in web application development. Let's delve deeper into each approach and consider the reasons behind their varying ... | 43,600 | [
{
"from": "human",
"value": "There seems to be three common approaches for mapping an application end user to a database user. \n\nOne to One Mapping: Each Application user (bob, nancy and fred) also get a corresponding database user account (bob nancy and fred).\nN to M mapping: Each application user is... |
Using ANTLR v3 and the CSharp2 language specifier, is there any way to indicate that you want the generated lexer or parser to be internal versus the default of public?
The namespace is specified with:
@lexer::namespace {My.Namespace}
and I would assume something similar exists for the access specifier, but I have bee... | In ANTLR v3, there is no direct built-in feature to specify access modifiers like `internal` for generated lexer or parser classes within the grammar file itself. The default access modifier for generated classes is `public`.
However, you can achieve `internal` visibility by employing a workaround. One common approach... | 44,778 | [
{
"from": "human",
"value": "Using ANTLR v3 and the CSharp2 language specifier, is there any way to indicate that you want the generated lexer or parser to be internal versus the default of public?\nThe namespace is specified with:\n@lexer::namespace {My.Namespace}\n\nand I would assume something similar ex... |
I'm needing to make this layout editor that uses a good bit of jQuery for letting one resort the items on their resume. I envisioned showing a dialog with a graphical representation of the sections, sort of like:
[Details - locked -- immovable]
[Overview -- immovable, but can be hidden or shown again]
----imaginary lin... | Creating a layout editor for a resume with sortable sections using jQuery sounds like a fun project! While I can't browse the web in real time to find a specific example, I can provide you with some guidance on how you might implement this using jQuery and HTML/CSS.
Here’s a general approach that could help you create... | 40,757 | [
{
"from": "human",
"value": "I'm needing to make this layout editor that uses a good bit of jQuery for letting one resort the items on their resume. I envisioned showing a dialog with a graphical representation of the sections, sort of like:\n[Details - locked -- immovable]\n[Overview -- immovable, but can ... |
I want to get the headers only from a curl request
curl -I www.google.com
All grand. Now I want to do that but to pass in post data too:
curl -I -d'test=test' www.google.com
But all I get is:
Warning: You can only select one HTTP request!
Anyone have any idea how to do this or am I doing something stupid?
| The warning you are seeing is due to the fact that when you use the `-I` (or `--head`) option with `curl`, it tells `curl` to issue a `HEAD` request, which does not send a body. However, you're also trying to send data with the `-d` option, which is typically used with `POST` requests.
When you try to combine these tw... | 46,093 | [
{
"from": "human",
"value": "I want to get the headers only from a curl request\ncurl -I www.google.com\nAll grand. Now I want to do that but to pass in post data too:\ncurl -I -d'test=test' www.google.com\nBut all I get is:\nWarning: You can only select one HTTP request!\nAnyone have any idea how to do thi... |
I've made lots of changes on a cloned git repository. Now I want the master to look exactly like the cloned copy - what command do I need to execute to that the master syncs with the clone?
Duplicate of: Git - pulling changes from clone back onto the master
| To synchronize your `master` branch with the changes you've made in your cloned Git repository, you can follow these steps. Assuming you are on the cloned repository and you want to push those changes to the `master` branch of the remote repository, here’s what you need to do:
1. **Make sure your changes are committed... | 47,057 | [
{
"from": "human",
"value": "I've made lots of changes on a cloned git repository. Now I want the master to look exactly like the cloned copy - what command do I need to execute to that the master syncs with the clone?\nDuplicate of: Git - pulling changes from clone back onto the master\n"
},
{
"fro... |
Given the schema:
MACHINE_TYPE { machine_type }
MACHINE { machine, machine_type }
SORT_PLAN { sort_plan, machine_type }
SCHEDULE { day_of_week, machine, sort_plan }
and the business rule:
A sort plan can be assigned to any
machine of the same machine_type.
How do I enforce that, in SCHEDULE, the tuples referenced... | To enforce the business rule that a sort plan can only be assigned to a machine of the same machine type in the `SCHEDULE` table, you can use a combination of foreign key constraints and a check constraint. Here’s one way to do it, using a modified schema:
### Modified Schema
1. **MACHINE_TYPE**: This remains unchang... | 44,141 | [
{
"from": "human",
"value": "Given the schema:\n\nMACHINE_TYPE { machine_type }\nMACHINE { machine, machine_type }\nSORT_PLAN { sort_plan, machine_type }\nSCHEDULE { day_of_week, machine, sort_plan }\n\nand the business rule:\n\nA sort plan can be assigned to any\n machine of the same machine_type.\n\nHow ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.