instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Yesterday, I found myself writing code like this:
SomeStruct getSomeStruct()
{
SomeStruct input;
cin >> input.x;
cin >> input.y;
}
Of course forgetting to actually return the struct I just created. Oddly enough, the values in the struct that was returned by this function got initialized to zero (when com... | The behavior you're observing is due to how C++ handles functions that are defined to return a value but do not explicitly return a value. In your `getSomeStruct` function, if you don't have a `return` statement, the function technically has undefined behavior when you attempt to use its return value. Here's a breakdow... | 47,916 | [
{
"from": "human",
"value": "Yesterday, I found myself writing code like this:\nSomeStruct getSomeStruct()\n{\n SomeStruct input;\n\n cin >> input.x;\n cin >> input.y;\n}\n\nOf course forgetting to actually return the struct I just created. Oddly enough, the values in the struct that was returned ... |
I have a fair number of Python scripts that contain reusable code that are used and referenced by other Python scripts. However, these scripts tend to be scattered across different directories and I find it to be somewhat tedious to have to include (most often multiple) calls to sys.path.append on my top-level scripts.... | Python does not have a direct equivalent to .NET's project files for managing imports and module paths. However, there are several approaches you can take to clean up your import statements and manage your project structure more effectively. Here are some options:
### 1. **Use a Package Structure**
If you have reusabl... | 42,838 | [
{
"from": "human",
"value": "I have a fair number of Python scripts that contain reusable code that are used and referenced by other Python scripts. However, these scripts tend to be scattered across different directories and I find it to be somewhat tedious to have to include (most often multiple) calls to... |
I need help in
figuring out how to iterate through currently open Excel add-in files (.xla) that have not been registered in Excel using the Tools > Add-ins menu path.
more specifically, I am interested in any workbook that doesn't appear in the Add-In dialog, but has ThisWorkbook.IsAddin = True.
Demonstrating the is... | In order to iterate through currently open Excel add-in files (.xla) that have `ThisWorkbook.IsAddin = True` but are not registered in the Add-Ins dialog, you can use a slightly different approach. Since the challenge involves accessing add-ins while considering user security settings, we can focus on the `Workbooks` c... | 46,967 | [
{
"from": "human",
"value": "I need help in\n\nfiguring out how to iterate through currently open Excel add-in files (.xla) that have not been registered in Excel using the Tools > Add-ins menu path.\nmore specifically, I am interested in any workbook that doesn't appear in the Add-In dialog, but has ThisWo... |
I have a book coming on F#, but at the moment I am pretty uninformed, so I thought I'd ask.
From very little I know of F#, I am struggling to see what it gains me over C# bar a possible syntactic neatness. There seems nothing conceptually new, or that isn't do-able in piian C#
I did Forth way back when (20 years ago n... | F# and C# are both powerful languages that run on the .NET platform, but they cater to slightly different programming paradigms and philosophies. Here are some aspects in which F# may provide advantages or different approaches compared to C#, especially if you are looking for more than just syntactic neatness:
### Fun... | 48,478 | [
{
"from": "human",
"value": "I have a book coming on F#, but at the moment I am pretty uninformed, so I thought I'd ask. \nFrom very little I know of F#, I am struggling to see what it gains me over C# bar a possible syntactic neatness. There seems nothing conceptually new, or that isn't do-able in piian C#... |
When I do this manually
public class AdventureWorks : DataContext
{
public AdventureWorks(string connection) : base(connection) { }
public Table<Contact> Contacts;
}
[Table(Name = "Person.Contact")]
public class Contact
{
[Column(DbType = "int not null", IsPrimaryKey = true, IsDbGenerated = true)]
pub... | When working with LINQ to SQL and using the designer (DBML), there are some key differences in how the classes and methods are generated compared to manual implementation.
### Understanding LINQ to SQL and DBML
1. **Manual Implementation**: When you define your DataContext and entity classes manually, you're in full ... | 42,752 | [
{
"from": "human",
"value": "When I do this manually\npublic class AdventureWorks : DataContext\n{\n public AdventureWorks(string connection) : base(connection) { }\n public Table<Contact> Contacts;\n}\n\n[Table(Name = \"Person.Contact\")]\npublic class Contact\n{\n\n [Column(DbType = \"int not nul... |
Is there a way to monitor processes starting in the system before they start?
Example:
On programs like ZoneAlarm or Antivirus programs, when you run a program it asks you if you allow running this program or not before it runs...
| Yes, there are ways to monitor processes before they start on your system, similar to the functionality provided by programs like ZoneAlarm or antivirus software. Here are some approaches you can consider:
1. **Windows Security (formerly Windows Defender)**:
- Windows has built-in protection that can notify you whe... | 48,815 | [
{
"from": "human",
"value": "Is there a way to monitor processes starting in the system before they start?\nExample:\nOn programs like ZoneAlarm or Antivirus programs, when you run a program it asks you if you allow running this program or not before it runs...\n"
},
{
"from": "gpt",
"value": "Y... |
I use a form to run a few codes on a database in Access. During update or deletion Access asks whether you want to update or delete.
I would like to know if there is any way of turning off these system messages or let the user choose his preference on whether he would like thoses messages to pop up or not.
| In Microsoft Access, when you're working with forms and executing update or delete operations, you may encounter system prompts asking for confirmation. These prompts are designed to prevent accidental data loss. However, you can turn them off programmatically or give the user an option to choose their preference.
###... | 49,242 | [
{
"from": "human",
"value": "I use a form to run a few codes on a database in Access. During update or deletion Access asks whether you want to update or delete. \nI would like to know if there is any way of turning off these system messages or let the user choose his preference on whether he would like tho... |
I have this:
<ListBox x:Name="PART_lstAttributes" Grid.Row="1" Style="{StaticResource GlossyBlackListBox}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock x:Name="txtAttributeName" Text="{Binding AttributeName}"></TextBlock>
</StackPanel>
</DataTemplate> ... | Yes, you can programmatically change the `AttributeName` property of the items bound to your `ListBox`. The approach you will take depends on how your data is structured.
If you are using a collection of objects (like a list of custom classes) and the `AttributeName` is a property of those objects, you can modify the... | 42,926 | [
{
"from": "human",
"value": "I have this:\n<ListBox x:Name=\"PART_lstAttributes\" Grid.Row=\"1\" Style=\"{StaticResource GlossyBlackListBox}\">\n <ListBox.ItemTemplate>\n <DataTemplate>\n <StackPanel>\n <TextBlock x:Name=\"txtAttributeName\" Text=\"{Binding AttributeName}\"></TextBlock>\n... |
I have a very simple SOAP web service that I need to consume from a Java client. What is the easiest way to accomplish this without using any third party libraries? A requirement is that the host and port is read from the web.xml before every call to the ws.
| To consume a SOAP web service from a Java client without using any third-party libraries, you can utilize Java's built-in features such as `HttpURLConnection` or `javax.xml.soap` package (if you want to construct and send SOAP requests manually). Below is a straightforward way to achieve this, leveraging the `HttpURLCo... | 42,593 | [
{
"from": "human",
"value": "I have a very simple SOAP web service that I need to consume from a Java client. What is the easiest way to accomplish this without using any third party libraries? A requirement is that the host and port is read from the web.xml before every call to the ws.\n"
},
{
"f... |
I bought a new Vista PC recently but was having lots of problems getting everything to work on it, so I continued doing most of my work (development and other) on a slow XP machine that I've had for years.
Until now, that is - I used VMware Convertor to take an image of my old XP machine, and now I'm running it on my V... | Using a virtual machine (VM) to manage your work can be very effective, but it’s important to establish a good backup and data management strategy, especially if you're relying heavily on the VM for development. Here are some recommendations based on your situation:
### 1. File Sharing Between Vista and the XP VM
Usi... | 43,783 | [
{
"from": "human",
"value": "I bought a new Vista PC recently but was having lots of problems getting everything to work on it, so I continued doing most of my work (development and other) on a slow XP machine that I've had for years.\nUntil now, that is - I used VMware Convertor to take an image of my old ... |
I want to load 52 images (deck of cards) in gif format from my recourse folder into an Image[] in c#. Any ideas?
Thanks,
Jon
| Certainly! To load 52 images (a deck of cards) in GIF format into an `Image[]` array in C#, you can utilize the `System.Drawing` namespace. Here's a basic example of how you could accomplish this.
First, make sure you have the necessary `using` directive at the top of your file:
```csharp
using System;
using System.... | 40,097 | [
{
"from": "human",
"value": "I want to load 52 images (deck of cards) in gif format from my recourse folder into an Image[] in c#. Any ideas?\nThanks,\nJon\n"
},
{
"from": "gpt",
"value": "Certainly! To load 52 images (a deck of cards) in GIF format into an `Image[]` array in C#, you can utilize... |
Generally I connect and retrieve data using the standard way (error checking removed for simplicity):
$db = mysql_select_db("dbname", mysql_connect("host","username","passord"));
$items = mysql_query("SELECT * FROM $db");
while($item = mysql_fetch_array($items)) {
my_function($item[rowname]);
}
Where my_function ... | To convert your procedural MySQL code to an object-oriented approach using MySQLi or PDO, you need to modify your code to use classes and methods instead of functions. Below, I will demonstrate both approaches: using MySQLi and PDO.
### Using MySQLi
Here is how you can rewrite your code using the MySQLi extension wit... | 44,429 | [
{
"from": "human",
"value": "Generally I connect and retrieve data using the standard way (error checking removed for simplicity):\n$db = mysql_select_db(\"dbname\", mysql_connect(\"host\",\"username\",\"passord\"));\n$items = mysql_query(\"SELECT * FROM $db\");\n\nwhile($item = mysql_fetch_array($items)) {... |
How would I only allow users authenticated via Python code to access certain files on the server?
For instance, say I have /static/book.txt which I want to protect. When a user accesses /some/path/that/validates/him, a Python script deems him worthy of accessing /static/book.txt and redirects him to that path.
How woul... | To restrict access to certain files on your server (like `/static/book.txt`), you need to ensure that only authenticated users can access those resources. Below are a couple of methods to achieve this in a Python web application, specifically focusing on two common frameworks: Flask and Django.
### Option 1: Using Fl... | 45,964 | [
{
"from": "human",
"value": "How would I only allow users authenticated via Python code to access certain files on the server?\nFor instance, say I have /static/book.txt which I want to protect. When a user accesses /some/path/that/validates/him, a Python script deems him worthy of accessing /static/book.tx... |
I have the following javascript code, which loads without error, however the update function does not actually seem functional, as get_Records.php is never loaded. I can not test if get_auction.php is loaded as it is loaded from within get_records.php
One of my main concerns is that I am doing the wrong thing by having... | There are several issues in your JavaScript and PHP code that need to be addressed for your `update` function to work correctly. Let’s go through your concerns and the code step-by-step to fix them.
### 1. The HTML Generation
In your original PHP code, the single quotes around the `onclick` attribute's JavaScript fun... | 44,056 | [
{
"from": "human",
"value": "I have the following javascript code, which loads without error, however the update function does not actually seem functional, as get_Records.php is never loaded. I can not test if get_auction.php is loaded as it is loaded from within get_records.php\nOne of my main concerns is... |
I'm running a project on a Postgres database and need to retrieve the comments on columns within the DB to be used as table headings and such. I have seen that there are a couple of built in functions (pg_description and col_description) but i haven't been able to find examples on how to use them and playing around wit... | In PostgreSQL, you can retrieve comments on columns using the `pg_description` table in conjunction with other system catalogs like `pg_attribute` and `pg_class`. Here's a step-by-step guide on how to retrieve comments for columns of a specific table.
### Step 1: Retrieve the Column Comments
You can use a query that ... | 46,281 | [
{
"from": "human",
"value": "I'm running a project on a Postgres database and need to retrieve the comments on columns within the DB to be used as table headings and such. I have seen that there are a couple of built in functions (pg_description and col_description) but i haven't been able to find examples ... |
I've heard from someone that they´re using a business process automation tool (like Weblogic Integration) as a programming language (what sounds like something kind of stupid) to make things declarative. Then they put all the logic inside a process, every single if and while.
But, isn´t a process a how to step-by-step ... | Your intuition about the nature of processes and the distinctions between declarative and imperative programming is quite insightful. Let's unpack this a bit.
1. **Imperative vs. Declarative**:
- **Imperative programming** is about telling the computer *how* to do something. This means writing step-by-step instruct... | 44,353 | [
{
"from": "human",
"value": "I've heard from someone that they´re using a business process automation tool (like Weblogic Integration) as a programming language (what sounds like something kind of stupid) to make things declarative. Then they put all the logic inside a process, every single if and while.\nB... |
I write this tiny C++ example in Eclipse 3.4.1 (CDT 5.0.1):
#include <iostream>
#include <vector>
#include <boost/foreach.hpp>
int foo()
{
std::vector<int> numbers;
BOOST_FOREACH(int n, numbers)
{
std::cout << n << std::endl;
}
std::cout << numbers.size << std::endl;
}
Then I hit Shift+Ctrl+F to format ... | The issue you're experiencing with the indentation of `BOOST_FOREACH` in Eclipse CDT appears to be a limitation in the built-in formatter's ability to recognize and handle certain macros and syntax correctly. Fortunately, there are some options and workarounds you can consider to improve the formatting:
### 1. Customi... | 47,678 | [
{
"from": "human",
"value": "I write this tiny C++ example in Eclipse 3.4.1 (CDT 5.0.1):\n#include <iostream>\n#include <vector>\n#include <boost/foreach.hpp>\n\nint foo()\n{\n std::vector<int> numbers;\n BOOST_FOREACH(int n, numbers)\n {\n std::cout << n << std::endl;\n }\n std::cout << numbers.siz... |
Assuming a class called Bar in a namespace called foo, which syntax do you prefer for your source (.cpp/.cc) file?
namespace foo {
...
void Bar::SomeMethod()
{
...
}
} // foo
or
void foo::Bar::SomeMethod()
{
...
}
I use namespaces heavily and prefer the first syntax, but when adding code using the Visual Stu... | Both syntaxes you provided are valid for defining methods of a class within a namespace, and each has its pros and cons. Here’s a breakdown of both approaches:
### 1. First Syntax: Nested within the Namespace
```cpp
namespace foo {
void Bar::SomeMethod()
{
...
}
} // namespace foo
```
**Advantages:**
- **Readabi... | 47,639 | [
{
"from": "human",
"value": "Assuming a class called Bar in a namespace called foo, which syntax do you prefer for your source (.cpp/.cc) file?\nnamespace foo {\n...\nvoid Bar::SomeMethod()\n{\n ...\n}\n\n} // foo\n\nor\nvoid foo::Bar::SomeMethod()\n{\n ...\n}\n\nI use namespaces heavily and prefer th... |
I'm new to Windows development and I have a question. I'm using a Mac with Boot Camp to run Windows in dual boot, but I have an extremely small Windows partition (10 GB, because Boot Camp failed with bigger partition, due to the disk usage). After installing Visual Studio 2008 I continuously get low-disk-space warnings... | When it comes to .NET Framework versions, it's important to understand how they are structured and dependencies between them. Here's a brief rundown:
1. **Backward Compatibility**: Each version of the .NET Framework is generally designed to be backward compatible with the previous versions. This means that if you have... | 48,368 | [
{
"from": "human",
"value": "I'm new to Windows development and I have a question. I'm using a Mac with Boot Camp to run Windows in dual boot, but I have an extremely small Windows partition (10 GB, because Boot Camp failed with bigger partition, due to the disk usage). After installing Visual Studio 2008 I... |
I'm working on a Java based project that has a client program which needs to connect to a MySQL database on a remote server. This was implemented is as follows:
Use JDBC to write the SQL queries to be executed which are then hosted as a servlet using Apache Tomcat and made accessible via XML-RPC. The client code uses X... | Your concerns about the current architecture of your Java-based project are valid, and it’s understandable that you're looking for a more efficient and manageable solution. Let's break down your considerations and explore some potential alternatives.
### 1. Storing Procedures with Access Control
Your idea of rewriting... | 43,795 | [
{
"from": "human",
"value": "I'm working on a Java based project that has a client program which needs to connect to a MySQL database on a remote server. This was implemented is as follows:\nUse JDBC to write the SQL queries to be executed which are then hosted as a servlet using Apache Tomcat and made acce... |
I'm working on a very simple game (essentially an ice sliding puzzle), for now the whole things in one file and the only level is completely blank of any form of obstacle. It throws up a few errors. My current annoyance is an expected primary expression error, can anyone tell me how to fix it (it throws up at line 99)?... | The errors you're encountering in the `movePlayer` function are due to the incorrect use of the `for` loop syntax. You are trying to use a condition inside the loop initialization section, which is not valid syntax in C/C++.
Here's the corrected version of the `movePlayer` function:
```cpp
void movePlayer() {
te... | 45,909 | [
{
"from": "human",
"value": "I'm working on a very simple game (essentially an ice sliding puzzle), for now the whole things in one file and the only level is completely blank of any form of obstacle. It throws up a few errors. My current annoyance is an expected primary expression error, can anyone tell me... |
What is the difference between
A simple fields-accesors-mutators class
A rich-modeled class
What constitutes rich modeling in business-domain classes?
| In object-oriented programming, the distinction between a "simple fields-accessors-mutators class" and a "rich-modeled class" primarily relates to the level of encapsulation, behavior, and complexity of the classes.
### Simple Fields-Accessors-Mutators Class
1. **Definition**: A simple fields-accessors-mutators class... | 43,622 | [
{
"from": "human",
"value": "What is the difference between\n\nA simple fields-accesors-mutators class\nA rich-modeled class\n\nWhat constitutes rich modeling in business-domain classes?\n"
},
{
"from": "gpt",
"value": "In object-oriented programming, the distinction between a \"simple fields-ac... |
I have a need to reference two different versions of the Sharepoint API dll. I have a webservice that needs to run under both Sharepoint 2 and Sharepoint 3, but also needs to work with new features provided by the Sharepoint 3 API (Checkout and Content Approval)
What is the best way to acheive this - I'm currently lea... | Your approach of using two separate projects with shared code via conditional compilation is a valid and effective way to manage the differences between the SharePoint 2 and SharePoint 3 APIs. However, here are a few alternative strategies you might consider, along with the pros and cons of each:
### Option 1: Conditi... | 44,433 | [
{
"from": "human",
"value": "I have a need to reference two different versions of the Sharepoint API dll. I have a webservice that needs to run under both Sharepoint 2 and Sharepoint 3, but also needs to work with new features provided by the Sharepoint 3 API (Checkout and Content Approval)\nWhat is the be... |
We have a table, name 'employeeReg' with fields
employeeNo | employeeName | Registered_on
Here Registered_on is a timestamp.
We require an hourly pattern of registrations, over a period of days. eg.
01 Jan 08 : 12 - 01 PM : 1592 registrations
01 Jan 08 : 01 - 02 PM : 1020 registrations
Can someone please suggest a q... | To achieve an hourly pattern of registrations from your `employeeReg` table in Oracle 10gR2, you can use the following SQL query. This query will group the registrations by hour and count the number of registrations in each hour for a specified date range.
Here is an example query:
```sql
SELECT
TO_CHAR(Registe... | 48,176 | [
{
"from": "human",
"value": "We have a table, name 'employeeReg' with fields\nemployeeNo | employeeName | Registered_on\n\nHere Registered_on is a timestamp.\nWe require an hourly pattern of registrations, over a period of days. eg.\n\n01 Jan 08 : 12 - 01 PM : 1592 registrations\n01 Jan 08 : 01 - 02 PM : 10... |
I'm using VB.net (2003), and calling the SelectNodes method on an xml document.
If I have a document:
<InqRs>
<DetRs>
<RefInfo>
<RefType>StopNum</RefType>
<RefId>0</RefId>
</RefInfo>
<RefInfo>
<RefType>Id</RefType>
<RefId>0</RefId>
</RefInfo>
</DetRs>
... | In order to select the specific `DetRs` element that contains a `RefInfo` element with `RefType` equal to `Id` and `RefId` equal to `0`, you need to ensure that both conditions are evaluated on the same `RefInfo` node.
The XPath query you need to use is as follows:
```xml
InqRs/DetRs[RefInfo[RefType='Id' and RefId='... | 45,773 | [
{
"from": "human",
"value": "I'm using VB.net (2003), and calling the SelectNodes method on an xml document.\nIf I have a document:\n<InqRs> \n <DetRs> \n <RefInfo> \n <RefType>StopNum</RefType> \n <RefId>0</RefId> \n </RefInfo> \n <RefInfo> \n <RefType>Id</RefType> \n ... |
I'm trying to build PIL 1.1.6 against cygwin or mingw whilst running against a windows install of python. When I do either the build works but I get the following failure when trying to save files.
$ python25
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright"... | The issue you're experiencing with saving images using PIL 1.1.6 (now known as Pillow) when compiled with Cygwin or MinGW is indeed likely related to the differences in how file descriptors are handled in these environments compared to a typical native Windows Python build.
When Python is built with Visual Studio, it ... | 47,261 | [
{
"from": "human",
"value": "I'm trying to build PIL 1.1.6 against cygwin or mingw whilst running against a windows install of python. When I do either the build works but I get the following failure when trying to save files.\n\n$ python25\nPython 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bi... |
I'm not sure, will the visual c ++ compiler express edition work for compiling c and if not can someone link me to an easy c compiler to use. Thanks in advance.
| Visual C++ Express Edition is primarily designed for C++ development, but it can compile C code as well, since C is a subset of C++. However, you may encounter some limitations or issues when working with C code in this environment. If you're looking for a more straightforward experience specifically for C programming,... | 46,646 | [
{
"from": "human",
"value": "I'm not sure, will the visual c ++ compiler express edition work for compiling c and if not can someone link me to an easy c compiler to use. Thanks in advance.\n"
},
{
"from": "gpt",
"value": "Visual C++ Express Edition is primarily designed for C++ development, but... |
I have an exe that I know was written in java. I understand that java programs can be made into an exe and there are tools to convert jar files to exe but is it possible to convert back? AFAIK jar files can be run on any platform that can run java and I would like to use a windows compiled java program on mac without u... | Converting a Windows executable (.exe) back to a Java Archive (.jar) is not a straightforward process and generally involves reverse engineering. Here are some insights and potential steps you can take:
### Understanding the Process
1. **Java to EXE Conversion**: Tools like Launch4j and JSmooth wrap Java applications... | 45,101 | [
{
"from": "human",
"value": "I have an exe that I know was written in java. I understand that java programs can be made into an exe and there are tools to convert jar files to exe but is it possible to convert back? AFAIK jar files can be run on any platform that can run java and I would like to use a windo... |
Currently I know several methods of connecting to a GUI remotely, or running GUI applications remotely:
Microsoft Terminal Services (only
works for remote windows;
installation);
VNC (it's slow);
XDMCP (requires a remote X server
running, has no session persistance);
Local X as remote DISPLAY for
applications (best so... | Creating a remote development environment with session persistence and mobility on Solaris or UNIX can be challenging, especially when looking for lightweight solutions. Here are some approaches you can consider:
1. **X2Go**:
- **Overview**: X2Go is a remote desktop solution that uses the NX technology protocol. I... | 44,750 | [
{
"from": "human",
"value": "Currently I know several methods of connecting to a GUI remotely, or running GUI applications remotely:\n\nMicrosoft Terminal Services (only\nworks for remote windows;\ninstallation);\nVNC (it's slow);\nXDMCP (requires a remote X server\nrunning, has no session persistance);\nLo... |
I've got a complex dialog, and it is full of whitespace and I can't shrink it. In Designer, it has lots of components that then get dynamically hidden, and a few which are dynamically added. I've added dumping of size policies, size hints, and minimum sizes, but still can't figure out why Qt won't let me drag it smal... | Debugging complex layouts in Qt can indeed be challenging, especially when you have dynamic components and hidden items that contribute to the overall size. Here are some techniques and tools you can use to troubleshoot and resolve the issue:
1. **Use the Qt Layout Inspector**:
- If you're using Qt Creator, you can... | 43,325 | [
{
"from": "human",
"value": "I've got a complex dialog, and it is full of whitespace and I can't shrink it. In Designer, it has lots of components that then get dynamically hidden, and a few which are dynamically added. I've added dumping of size policies, size hints, and minimum sizes, but still can't fi... |
How can I launch the Safari browser or the user's default browser pointing it to a specific address from within my Mac application?
I am using Objective-C as the programming language.
Thanks.
| To launch the Safari browser or the user's default web browser and direct it to a specific URL from within your macOS application using Objective-C, you can use the `NSWorkspace` class. This class provides a convenient method to open URLs in the default web browser.
Here’s a simple example of how you can do this:
```... | 47,557 | [
{
"from": "human",
"value": "How can I launch the Safari browser or the user's default browser pointing it to a specific address from within my Mac application?\nI am using Objective-C as the programming language.\nThanks.\n"
},
{
"from": "gpt",
"value": "To launch the Safari browser or the user... |
How do I bind a CheckBoxField in my GridView to an underlying db field that is a string. The string is either "1" or "0" but all the same the GridView won't willingly bind to it. What do I do. What is the best way to have a checkbox in the GridView and have it get and set the string in the database (or the underlying d... | To bind a `CheckBoxField` in a `GridView` to a string field in your database that contains values "1" or "0", you'll need to convert the string values to boolean values that the `CheckBox` can work with. Here's a step-by-step approach on how to achieve this:
### Step 1: Create a TemplateField
Instead of using `CheckB... | 43,942 | [
{
"from": "human",
"value": "How do I bind a CheckBoxField in my GridView to an underlying db field that is a string. The string is either \"1\" or \"0\" but all the same the GridView won't willingly bind to it. What do I do. What is the best way to have a checkbox in the GridView and have it get and set th... |
I have the following code to zip all the files and then save it to the harddisk. I want zip all the files (this is done) and then attach the zip file to the Response stream so that the user have the option to save it!
protected void DownloadSelectedFiles_Click(object sender, EventArgs e)
{
string p... | Your current code correctly creates a ZIP file from selected files and then attempts to serve that ZIP file for download. However, you're saving the ZIP file to disk and then reading it back to send it as a response, which isn't necessary and can lead to issues (e.g., file locks, permissions, etc.). Instead, you can cr... | 46,252 | [
{
"from": "human",
"value": "I have the following code to zip all the files and then save it to the harddisk. I want zip all the files (this is done) and then attach the zip file to the Response stream so that the user have the option to save it! \nprotected void DownloadSelectedFiles_Click(object sender, E... |
I'm using the Database Publishing Wizard in VS2008 to push changes to my hosting provider. It doesn't look like those settings go with the project (which seems a little silly to me), but rather they go with the machine.
On each new machine that I'd like to publish from I need to go through the process of digging up ... | The Database Publishing Wizard in Visual Studio 2008 does not provide a built-in feature to export or save the database publishing settings directly to a file. However, there are a few workarounds you can use to manage your publishing settings more easily across different machines:
1. **Manual Configuration File**: Yo... | 42,281 | [
{
"from": "human",
"value": "I'm using the Database Publishing Wizard in VS2008 to push changes to my hosting provider. It doesn't look like those settings go with the project (which seems a little silly to me), but rather they go with the machine. \nOn each new machine that I'd like to publish from I nee... |
I create a file in JavaScript. Now I want to be able to make it available to the user as a download is this possible?
To be exact it is a KML File I create so its basic XML.
| Yes, you can make a KML (or any other type of file) available for download in JavaScript. You can achieve this by creating a Blob object that contains the file's content and using an anchor (`<a>`) element with a `download` attribute to trigger the download.
Here’s a simple example of how to do this for a KML file:
`... | 44,976 | [
{
"from": "human",
"value": "I create a file in JavaScript. Now I want to be able to make it available to the user as a download is this possible?\nTo be exact it is a KML File I create so its basic XML.\n"
},
{
"from": "gpt",
"value": "Yes, you can make a KML (or any other type of file) availab... |
Per this page http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_rbtree.aspx
"Top-down deletion" is an implementation of a red-black tree node removal that pro-actively balances a tree by pushing a red node down through the tree so that the leaf node which is being removed is guaranteed to be red. Since t... | The analysis you've provided highlights important distinctions between top-down and bottom-up deletion methods in red-black trees, and it raises valid points regarding the efficiency of the top-down approach.
### Key Points:
1. **Top-Down Deletion**:
- The essence of top-down deletion is that it seeks to maintain ... | 45,053 | [
{
"from": "human",
"value": "Per this page http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_rbtree.aspx \n\"Top-down deletion\" is an implementation of a red-black tree node removal that pro-actively balances a tree by pushing a red node down through the tree so that the leaf node which is bei... |
As we all know that javascript is an open source language and we are using Mozilla FireFox 3 and in this browser the mozilla foundation has released a newer version of the javascript but i am still unable to figure out that really where is the javascript source code in the FireFox 3 browser and where is the list of the... | JavaScript is indeed an open-source language, and many implementations of JavaScript are available, including those in browsers like Mozilla Firefox. The JavaScript engine used in Firefox is called SpiderMonkey. While the language itself has specifications defined by ECMA International (in the ECMAScript standard), spe... | 45,386 | [
{
"from": "human",
"value": "As we all know that javascript is an open source language and we are using Mozilla FireFox 3 and in this browser the mozilla foundation has released a newer version of the javascript but i am still unable to figure out that really where is the javascript source code in the FireF... |
I'm using the following line to read in an XML document that may or may not have some comments bracketed by "<!-- -->" near the top of my XML file:
XDocument xe1 = XDocument.Load(filepath)
How do I read in the comments and store as a string?
I'm doing this in MS Visual Studio C#.
I know there's something called "XCo... | In C#, when you load an XML document using `XDocument`, you can access comments in the document using `XComment`. Here's how you can read comments from the top of your XML document and store them as a string.
Here's a simple example to demonstrate how you can achieve this:
```csharp
using System;
using System.IO;
usi... | 45,805 | [
{
"from": "human",
"value": "I'm using the following line to read in an XML document that may or may not have some comments bracketed by \"<!-- -->\" near the top of my XML file:\nXDocument xe1 = XDocument.Load(filepath)\n\nHow do I read in the comments and store as a string? \nI'm doing this in MS Visual ... |
I have a column that has fields such as C5, C6, C3, CC, CA, CD, etc.
I want to be able to find all the columns that have a letter and then a number such as C5 and C6.
I know if I do:
SELECT * FROM TABLE WHERE FIELD LIKE 'C%'
It will return CC,CA,CD as well, but I don't want that, I want to just return the ones numbe... | To achieve your goal of selecting only the entries in your column that contain a letter followed by a number (like C5 and C6), you can use a combination of SQL's `LIKE` operator with a wildcard for digits. The pattern you need can be expressed with a wildcard that specifically looks for a letter followed by a digit.
H... | 47,724 | [
{
"from": "human",
"value": "I have a column that has fields such as C5, C6, C3, CC, CA, CD, etc. \nI want to be able to find all the columns that have a letter and then a number such as C5 and C6.\nI know if I do:\nSELECT * FROM TABLE WHERE FIELD LIKE 'C%'\n\nIt will return CC,CA,CD as well, but I don't w... |
SOLVED: Nevermind, the links were visited, and the border definition was missing for visited links (as someone pointed out, thanks). As for the color being first place in the border definition, the snippet comes from the IE Developper Toolbar, this is not directly my code. Anyway, thank you guys !
Why does the link in ... | The issue you are experiencing with the link not rendering underlined with a dashed line can be attributed to how CSS styles are applied to the `<a>` element and the fact that you are using the `BORDER-BOTTOM` property along with `TEXT-DECORATION: none`.
Here are a few key points to consider:
1. **Text Decoration vs... | 46,183 | [
{
"from": "human",
"value": "SOLVED: Nevermind, the links were visited, and the border definition was missing for visited links (as someone pointed out, thanks). As for the color being first place in the border definition, the snippet comes from the IE Developper Toolbar, this is not directly my code. Anywa... |
As in the subject, how can one get the total width of an element, including its border and padding, using jQuery? I've got the jQuery dimensions plugin, and running .width() on my 760px-wide, 10px padding DIV returns 760.
Perhaps I'm doing something wrong, but if my element manifests itself as 780 pixels wide and Fire... | To get the total width of an element, including its padding and border, you can use jQuery's `outerWidth()` method. By default, `outerWidth()` will return the width of the element, including padding, but it can also include the border if you pass a `true` argument.
Here's how you can do it:
```javascript
var totalWid... | 47,978 | [
{
"from": "human",
"value": "As in the subject, how can one get the total width of an element, including its border and padding, using jQuery? I've got the jQuery dimensions plugin, and running .width() on my 760px-wide, 10px padding DIV returns 760.\nPerhaps I'm doing something wrong, but if my element ma... |
Is it even sensible to try forming a scrum when one of the participants is in India (+05:30), and others are in the US (-06:00 and -08:00)? There isn't a comfortable meeting time for everyone with that.
| Forming a Scrum team with participants in different time zones can indeed be challenging, but it's not impossible. Here are some considerations and strategies to make it work:
1. **Time Zone Awareness**: Understand the time differences. For example, if one participant is in India (UTC+5:30) and others are in the US (U... | 49,027 | [
{
"from": "human",
"value": "Is it even sensible to try forming a scrum when one of the participants is in India (+05:30), and others are in the US (-06:00 and -08:00)? There isn't a comfortable meeting time for everyone with that.\n"
},
{
"from": "gpt",
"value": "Forming a Scrum team with part... |
I am working with PHP and I am wondering how bad practise it is to combine lots of functions into a class. I am aware of it's not the purpose of classes, but the reason why I would do this is to provide a namespace. How big impact does it make to initiate let's say 10 classes at the execution of a PHP script instead of... | Combining many functions into a single class for the purpose of providing a namespace can be seen as an anti-pattern in object-oriented programming. Here are several considerations regarding this approach and the performance implications of instantiating multiple classes in PHP:
### 1. **Design Considerations**
- **S... | 45,861 | [
{
"from": "human",
"value": "I am working with PHP and I am wondering how bad practise it is to combine lots of functions into a class. I am aware of it's not the purpose of classes, but the reason why I would do this is to provide a namespace. How big impact does it make to initiate let's say 10 classes at... |
I do remember seeing someone ask something along these lines a while ago but I did a search and couldn't find anything.
I'm trying to come up with the cleanest way to clear all the controls on a form back to their defaults (e.g., clear textboxes, uncheck checkboxes).
How would you go about this?
| Clearing all controls on a form back to their default states can be handled in a few different ways depending on the programming language and framework you're using. Below are examples for a couple of common frameworks: WinForms (C#) and WPF (C#), as well as a general approach for web forms (HTML/CSS/JavaScript).
###... | 42,528 | [
{
"from": "human",
"value": "I do remember seeing someone ask something along these lines a while ago but I did a search and couldn't find anything. \nI'm trying to come up with the cleanest way to clear all the controls on a form back to their defaults (e.g., clear textboxes, uncheck checkboxes).\nHow woul... |
What is the best way to get the current system time milliseconds?
| The method to get the current system time in milliseconds can vary depending on the programming language you are using. Here are examples for a few popular languages:
### JavaScript
In JavaScript, you can use `Date.now()`:
```javascript
const currentTimeInMilliseconds = Date.now();
console.log(currentTimeInMillisecon... | 48,942 | [
{
"from": "human",
"value": "What is the best way to get the current system time milliseconds?\n"
},
{
"from": "gpt",
"value": "The method to get the current system time in milliseconds can vary depending on the programming language you are using. Here are examples for a few popular languages:\n... |
I'm stuck in a battle between ReSharper and StyleCop, and I'd like to let ReSharper win, but I want to hear the arguments in favour of StyleCop before I do that.
When I'm writing long argument lists ReSharper sensibly chops the parameter list and restarts it on the next line. I find that much more readable.
When I run ... | When considering the arguments in favor of using StyleCop alongside ReSharper, it’s important to understand that both tools serve somewhat different purposes and can complement each other despite some conflicts in their rules. Here are some arguments in favor of StyleCop:
1. **Consistency and Standardization**: StyleC... | 46,759 | [
{
"from": "human",
"value": "I'm stuck in a battle between ReSharper and StyleCop, and I'd like to let ReSharper win, but I want to hear the arguments in favour of StyleCop before I do that.\nWhen I'm writing long argument lists ReSharper sensibly chops the parameter list and restarts it on the next line. I... |
I'm developing an HTML newsletter system using PHP & PEAR. It sends out the emails fine.
However I cannot force Apple Mail to reload images from the server. I have tried:
Restarting Mail
Clear ~/Library/MailDownloads
Clear ~/Library/Cache/Mail
Empty Safari cache
Does any one know where Apple Mail caches the images ?... | Apple Mail can be quite aggressive with its caching, which can sometimes prevent images from reloading as expected. Here are a few additional suggestions you can try to ensure images are reloaded from the server:
1. **Cache Control Headers**: Ensure that your server is sending appropriate cache control headers. You ca... | 48,333 | [
{
"from": "human",
"value": "I'm developing an HTML newsletter system using PHP & PEAR. It sends out the emails fine.\nHowever I cannot force Apple Mail to reload images from the server. I have tried:\n\nRestarting Mail\nClear ~/Library/MailDownloads \nClear ~/Library/Cache/Mail\nEmpty Safari cache\n\nDoes ... |
Although this question looks simple, it is kind of tricky.
Consider the following table:
CREATE TABLE A (
id INT,
value FLOAT,
"date" DATETIME,
group VARCHAR(50)
);
I would like to obtain the ID and value of the records that contain the maximum date grouped by the column group. In other words, something like ... | To retrieve the `id` and `value` of the records that contain the maximum date for each group from the table `A`, you can use a common table expression (CTE) or a subquery to first determine the maximum date for each group, and then join it back to the original table to get the associated `id` and `value`. Here's how yo... | 47,622 | [
{
"from": "human",
"value": "Although this question looks simple, it is kind of tricky.\nConsider the following table:\nCREATE TABLE A (\n id INT,\n value FLOAT,\n \"date\" DATETIME,\n group VARCHAR(50) \n);\n\nI would like to obtain the ID and value of the records that contain the maximum date grouped ... |
Where does Firefox store cookies and in what format are they stored
| As of my last knowledge update in October 2023, Mozilla Firefox stores cookies in a SQLite database file located in the user's profile directory. The specific file is named `cookies.sqlite`.
### Location:
- **On Windows:** `C:\Users\<YourUsername>\AppData\Roaming\Mozilla\Firefox\Profiles\<YourProfile>\cookies.sqlite`... | 49,302 | [
{
"from": "human",
"value": "Where does Firefox store cookies and in what format are they stored\n"
},
{
"from": "gpt",
"value": "As of my last knowledge update in October 2023, Mozilla Firefox stores cookies in a SQLite database file located in the user's profile directory. The specific file is... |
I want to use HTTP GET and POST commands to retrieve URLs from a website and parse the HTML. How do I do this?
| To retrieve URLs from a website and parse the HTML using HTTP GET and POST commands, you can use various programming languages and libraries. Here's an example using Python with the `requests` library for making HTTP requests and `BeautifulSoup` for parsing HTML.
### Step 1: Install Required Libraries
Make sure you h... | 44,132 | [
{
"from": "human",
"value": "I want to use HTTP GET and POST commands to retrieve URLs from a website and parse the HTML. How do I do this?\n"
},
{
"from": "gpt",
"value": "To retrieve URLs from a website and parse the HTML using HTTP GET and POST commands, you can use various programming langua... |
How can I convert a bitmap to a byte array in c++ WITHOUT the .net framework?
| Converting a bitmap to a byte array in C++ without using the .NET framework can be done using the Windows GDI (Graphics Device Interface). Below is an example that demonstrates how to load a bitmap file, read its pixel data, and convert it to a byte array.
Here's a simple example that assumes you are working with a BM... | 43,382 | [
{
"from": "human",
"value": "How can I convert a bitmap to a byte array in c++ WITHOUT the .net framework?\n"
},
{
"from": "gpt",
"value": "Converting a bitmap to a byte array in C++ without using the .NET framework can be done using the Windows GDI (Graphics Device Interface). Below is an examp... |
The top of my web.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
version="2.5">
But I... | The issue you're encountering is related to Eclipse not being able to correctly validate your `web.xml` file against the specified XML schema. Here are several steps you can take to resolve this issue:
### 1. Check Eclipse Version
Ensure that you are using an updated version of Eclipse. Ganymede is quite old, and usin... | 45,123 | [
{
"from": "human",
"value": "The top of my web.xml file looks like this:\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<web-app xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/... |
How do you round a Double down to the nearest integer in VB .NET?
| In VB.NET, you can round a `Double` down to the nearest integer using the `Math.Floor` method. This method returns the largest integer less than or equal to the specified number, effectively rounding down.
Here’s an example:
```vb.net
Dim myDouble As Double = 12.78
Dim roundedDown As Integer = CInt(Math.Floor(myDoubl... | 49,826 | [
{
"from": "human",
"value": "How do you round a Double down to the nearest integer in VB .NET?\n"
},
{
"from": "gpt",
"value": "In VB.NET, you can round a `Double` down to the nearest integer using the `Math.Floor` method. This method returns the largest integer less than or equal to the specifi... |
Background
I want to be able to parse Javascript source in a Delphi Application. I need to be able to identify variables and functions within the source for the purpose of making changes to the code through later code. I understand that I probably need to use a lexer for this purpose but have not had much luck using th... | As of my last knowledge update in October 2023, there are a few options for parsing JavaScript in Delphi, but finding a robust and actively maintained lexer or parser specifically for JavaScript might be a challenge. Here are some suggestions for tools and approaches that might help you achieve your goal:
### Existing... | 43,343 | [
{
"from": "human",
"value": "Background\nI want to be able to parse Javascript source in a Delphi Application. I need to be able to identify variables and functions within the source for the purpose of making changes to the code through later code. I understand that I probably need to use a lexer for this p... |
What are the best and worst emacs key bindings in development software? Ever since I learned it, I find myself trying to use C-p and C-n to move up and down in everything that has a text box on it.
I'm perpetually annoyed by software that has an emacs mode that's pretty obviously either put together by someone who's n... | Emacs key bindings are beloved by many developers for their efficiency and consistency, but not all software implements them well. Here's a breakdown of some of the best and worst Emacs key bindings you've likely encountered in development software.
### Best Emacs Key Bindings
1. **C-p (Control + p)**: Move up (previ... | 44,611 | [
{
"from": "human",
"value": "What are the best and worst emacs key bindings in development software? Ever since I learned it, I find myself trying to use C-p and C-n to move up and down in everything that has a text box on it.\nI'm perpetually annoyed by software that has an emacs mode that's pretty obviou... |
I've got an NSColor, and I really want the 32-bit RGBA value that it represents. Is there any easy way to get this, besides extracting the float components, then multiplying and ORing and generally doing gross, endian-dependent things?
Edit: Thanks for the help. Really, what I was hoping for was a Cocoa function that... | You can easily extract the 32-bit RGBA value from an `NSColor` in Cocoa by using the `CGColor` representation of the color. Here's a simple method to do that:
1. Convert your `NSColor` to a `CGColor`.
2. Extract the RGBA components using `CGColor`.
Here’s a Swift function that does this for you:
```swift
import Coco... | 46,371 | [
{
"from": "human",
"value": "I've got an NSColor, and I really want the 32-bit RGBA value that it represents. Is there any easy way to get this, besides extracting the float components, then multiplying and ORing and generally doing gross, endian-dependent things?\nEdit: Thanks for the help. Really, what ... |
I'm looking for a command line to remove all view-private files and directories from a ClearCase view on Windows. I have Cygwin available as well.
The script available at this article is not quite what I want, since I'm working with a large number of files and want to delete them all without having to select each one.... | To remove all view-private files and directories from a ClearCase view using the command line, you can use the following commands within a Cygwin or Windows Command Prompt environment. Here’s how you can do it:
### Using Cygwin
You can use the following `find` command to locate and remove all view-private files and d... | 47,424 | [
{
"from": "human",
"value": "I'm looking for a command line to remove all view-private files and directories from a ClearCase view on Windows. I have Cygwin available as well.\nThe script available at this article is not quite what I want, since I'm working with a large number of files and want to delete t... |
I'm customizing the 404 page for my website. I'd like it to include a "Did you mean...?" I need to figure out how to do this.
Here's what I'm doing so far: I come up with a broad list of files that the user might be looking for, then use levenshtein() to compare each possible filename to the mistyped filename. Those... | Creating a "Did you mean...?" feature for your 404 page is a great way to enhance user experience. Your current approach using Levenshtein distance is a solid choice for identifying similar filenames based on character differences. Below are some suggestions and considerations to optimize your approach:
### 1. Using L... | 44,961 | [
{
"from": "human",
"value": "I'm customizing the 404 page for my website. I'd like it to include a \"Did you mean...?\" I need to figure out how to do this.\nHere's what I'm doing so far: I come up with a broad list of files that the user might be looking for, then use levenshtein() to compare each possib... |
I've seen the term "lexical variable" a few times, mostly in the context of closures. Paul Graham uses the term in his books on Lisp referring to variables defined using the let expression.
I understand that lexical scoping is another name for static scoping. Is lexical variable just a variable that is visible in a pr... | You're on the right track with your understanding of lexical variables! Let's clarify what a lexical variable is in the context of programming, particularly with regard to closures and lexical scoping.
### Lexical Variables:
1. **Definition**: A lexical variable is a variable that is bound to its value in a specific ... | 47,946 | [
{
"from": "human",
"value": "I've seen the term \"lexical variable\" a few times, mostly in the context of closures. Paul Graham uses the term in his books on Lisp referring to variables defined using the let expression. \nI understand that lexical scoping is another name for static scoping. Is lexical vari... |
I just picked up Agile Web Development with Rails 3rd Ed., and I'm going thru the Depot Application chapters, and I have a question about Product/Item options.
If I wanted to modify the product catalog and store so that products could have options (size, color, whatever), where/how would I do that?
Let's say I'm sellin... | To handle product options like sizes and colors in your Rails application, you can indeed add a select box for the options in your view. The `button_to` helper creates a form for you, but it can only send certain parameters by default (i.e., the product's ID in your case). To add additional parameters, such as the sele... | 44,763 | [
{
"from": "human",
"value": "I just picked up Agile Web Development with Rails 3rd Ed., and I'm going thru the Depot Application chapters, and I have a question about Product/Item options.\nIf I wanted to modify the product catalog and store so that products could have options (size, color, whatever), where... |
I have written some CSS which targets elements using the parent > child selector. Specifically for tables so I can apply certain styles to the headers and footers like this
table > thead > tr > th ...
table > tbody > tr > td ...
//there are other uses in the css as well
This works great, except in IE6. What is my best... | To ensure your CSS works properly in Internet Explorer 6, you'll need to adjust your selectors since IE6 does not fully support the child combinator (`>`) that you're using in your CSS. Here are some strategies to "unfactor" your CSS for better compatibility with IE6:
### 1. Remove Child Combinators
You can simply re... | 46,179 | [
{
"from": "human",
"value": "I have written some CSS which targets elements using the parent > child selector. Specifically for tables so I can apply certain styles to the headers and footers like this\ntable > thead > tr > th ...\ntable > tbody > tr > td ...\n//there are other uses in the css as well\n\nTh... |
I was just browsing a forum and someone asked about a PHP file they had found on the web. It has several spots like this in the code:
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
I have always thought brackets are needed to enclose what you want to do if the condition is true. Is the... | In PHP, you can use either curly braces `{}` or a colon `:` to define the blocks of code that belong to a conditional statement. Both syntaxes are valid and can be used interchangeably, which is likely why you see different styles in the code you found.
1. **Curly Braces Syntax**:
This is the most common way to wri... | 47,685 | [
{
"from": "human",
"value": "I was just browsing a forum and someone asked about a PHP file they had found on the web. It has several spots like this in the code:\nif ($REMOTE_ADDR == \"\") $ip = \"no ip\";\nelse $ip = getHostByAddr($REMOTE_ADDR);\nI have always thought brackets are needed to enclose what ... |
I just learned something interesting. The add method for the javascript select object in IE 6 takes only one parameter. It throws an error when you pass it two parameters which I believe is the standard, even as documented on the MSDN site.
My question is this. What is your best-practice recommendation for programmatic... | When dealing with cross-browser compatibility issues like the differences in the `add` method for the select object in IE6 compared to modern browsers, it's essential to ensure your solution is maintainable and not overly complicated. Here are three best-practice recommendations for programmatically adding option eleme... | 43,727 | [
{
"from": "human",
"value": "I just learned something interesting. The add method for the javascript select object in IE 6 takes only one parameter. It throws an error when you pass it two parameters which I believe is the standard, even as documented on the MSDN site.\nMy question is this. What is your bes... |
I know how to do this using for loops. Is it possible to do something like this using LINQ or lambdas?
int[] a = { 10, 20, 30 };
int[] b = { 2, 4, 10 };
int[] c = a * b; //resulting array should be { 20, 80, 300 }
| Yes, you can achieve the multiplication of two arrays using LINQ and lambda expressions in C#. The `Zip` method from LINQ can be particularly useful in this case, as it allows you to combine two sequences element-wise.
Here's how you can use it to multiply the corresponding elements of two arrays:
```csharp
using Sys... | 49,110 | [
{
"from": "human",
"value": "I know how to do this using for loops. Is it possible to do something like this using LINQ or lambdas?\nint[] a = { 10, 20, 30 };\nint[] b = { 2, 4, 10 };\nint[] c = a * b; //resulting array should be { 20, 80, 300 }\n\n"
},
{
"from": "gpt",
"value": "Yes, you can a... |
Is it possible to create an sql statement that selects the week number (NOT the day of week - or the day number in a week). I'm creating a view to select this extra information along with a couple of other fields and thus can not use a stored procedure. I'm aware that it's possible to create a UDF to do the trick, but ... | To calculate the week number based on your criteria (where the week starts on Monday and the first week of the year is the week with at least four days), you can use SQL's built-in date functions without having to create a stored procedure or user-defined function.
Assuming you're using a SQL database like PostgreSQL... | 44,140 | [
{
"from": "human",
"value": "Is it possible to create an sql statement that selects the week number (NOT the day of week - or the day number in a week). I'm creating a view to select this extra information along with a couple of other fields and thus can not use a stored procedure. I'm aware that it's possi... |
In the recent update of java (6.10) http://java.sun.com/javase/6/webnotes/6u10.htmllink text the way that unsigned applets was changed. A warning is now displayed. Is it possible to turn this off without signing your applet?
| In Java 6 Update 10, there was indeed a change that introduced warnings for unsigned applets for security reasons. Unfortunately, there is no way to disable these warnings without signing the applet. The warnings are a part of the Java security model aimed at protecting users from potentially harmful unsigned code.
To... | 49,720 | [
{
"from": "human",
"value": "In the recent update of java (6.10) http://java.sun.com/javase/6/webnotes/6u10.htmllink text the way that unsigned applets was changed. A warning is now displayed. Is it possible to turn this off without signing your applet?\n"
},
{
"from": "gpt",
"value": "In Java 6... |
When I use the MouseUp event, I can get it to fire with a mouse right-click. But MouseLeftButtonUp won't fire with either click!
<Button MouseLeftButtonUp="btnNewConfig_MouseUp" Name="btnNewConfig">
<StackPanel Orientation="Horizontal">
<Image Source="Icons\new.ico" Height="24" Width="24" Margin="5"/>
... | In WPF (Windows Presentation Foundation), there are a few things to check if the `MouseLeftButtonUp` event isn't firing as expected.
1. **Event Handler Correctness**: First, make sure that your event handler `btnNewConfig_MouseUp` is properly defined in the code-behind file. It should look something like this:
``... | 47,221 | [
{
"from": "human",
"value": "When I use the MouseUp event, I can get it to fire with a mouse right-click. But MouseLeftButtonUp won't fire with either click!\n<Button MouseLeftButtonUp=\"btnNewConfig_MouseUp\" Name=\"btnNewConfig\">\n <StackPanel Orientation=\"Horizontal\">\n <Image Source=\"Icon... |
Has anyone experienced memcached limitations in terms of:
of objects in cache store - is there a point where it loses performance?
Amount of allocated memory - what are the basic numbers to work with?
| Yes, there are several limitations and considerations when using Memcached that can affect performance and overall behavior:
### 1. Objects in Cache Store
**Performance Concerns:**
- **Number of Objects:** While Memcached can handle a large number of objects, having too many small objects can lead to inefficiencies. ... | 44,277 | [
{
"from": "human",
"value": "Has anyone experienced memcached limitations in terms of:\n\nof objects in cache store - is there a point where it loses performance?\nAmount of allocated memory - what are the basic numbers to work with?\n\n"
},
{
"from": "gpt",
"value": "Yes, there are several limi... |
I have CustomForm inherited from Form which implements a boolean property named Prop. The forms I'll be using will inherit from CustomForm. This property will do some painting and changes (if it's enabled) to the form. However, this is not working as it should, the VS IDE designed is not being refresh to show the chang... | In Windows Forms, when you're working with custom forms and you want to force the Visual Studio Designer to refresh or repaint itself, it can be quite tricky because the designer does not provide an explicit way to force a refresh programmatically from within the code of the form itself. The designer behaves differentl... | 42,844 | [
{
"from": "human",
"value": "I have CustomForm inherited from Form which implements a boolean property named Prop. The forms I'll be using will inherit from CustomForm. This property will do some painting and changes (if it's enabled) to the form. However, this is not working as it should, the VS IDE design... |
MathWorks currently doesn't allow you to use cout from a mex file when the MATLAB desktop is open because they have redirected stdout. Their current workaround is providing a function, mexPrintf, that they request you use instead. After googling around a bit, I think that it's possible to extend the std::stringbuf cl... | Your approach to extending `std::stringbuf` to create a custom output stream for use with MATLAB's MEX interface is an interesting one. However, there are several improvements and considerations to keep in mind to ensure robustness and compatibility.
### Issues in Your Current Implementation
1. **Using `mexPrintf`**:... | 43,026 | [
{
"from": "human",
"value": "MathWorks currently doesn't allow you to use cout from a mex file when the MATLAB desktop is open because they have redirected stdout. Their current workaround is providing a function, mexPrintf, that they request you use instead. After googling around a bit, I think that it's... |
I have a gridview control which displays data returned from DB. The datakey property of the gridview is bound to the ID column of the DB
Each record in the GV had 2 buttons and one Checkbox. When either of these controls is clicked I want to obtain the row that this was clicked on and perform action depending on which ... | To handle events for buttons and checkboxes within a GridView, the `RowCommand` event is indeed the correct approach, but you need to ensure that you're setting up your GridView properly and correctly capturing the command from the controls.
Here’s a general approach to accomplish what you’re trying to achieve:
1. **... | 44,534 | [
{
"from": "human",
"value": "I have a gridview control which displays data returned from DB. The datakey property of the gridview is bound to the ID column of the DB\nEach record in the GV had 2 buttons and one Checkbox. When either of these controls is clicked I want to obtain the row that this was clicked... |
Suppose a shell script (/bin/sh or /bin/bash) contained several commands. How can I cleanly make the script terminate if any of the commands has a failing exit status? Obviously, one can use if blocks and/or callbacks, but is there a cleaner, more concise way? Using && is not really an option either, because the com... | You can achieve clean termination of your shell script upon any command failure by using the `set -e` option. When this option is enabled, the shell will immediately exit with a non-zero status if any command exits with a non-zero status.
Here’s how you can use it in your script:
```bash
#!/bin/bash
set -e
# Your c... | 45,541 | [
{
"from": "human",
"value": "Suppose a shell script (/bin/sh or /bin/bash) contained several commands. How can I cleanly make the script terminate if any of the commands has a failing exit status? Obviously, one can use if blocks and/or callbacks, but is there a cleaner, more concise way? Using && is not... |
I am in the process of creating an XML Schema and one of my values is a year. As such, I'd like to ensure that all values have exactly 4 characters. To do so, I am using the following syntax:
<xs:element name="publish_year" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:tota... | You're correct in thinking that the `totalDigits` facet alone would not prevent a value like "200" from being considered valid, because it's only concerned with the total number of digits in the number and not the specific format of the year. To ensure that the value is specifically a 4-digit year, using a regular expr... | 47,051 | [
{
"from": "human",
"value": "I am in the process of creating an XML Schema and one of my values is a year. As such, I'd like to ensure that all values have exactly 4 characters. To do so, I am using the following syntax:\n<xs:element name=\"publish_year\" maxOccurs=\"1\">\n <xs:simpleType>\n <xs:restr... |
How would I go upon detecting input for a console application in C#?
Let's say for example I want the console application to start up by writing:
Welcome To Food Hut
(cursor to type stuff here after the first line)
I would want the console application to detect two commands:
1: /help - which will display some help gibb... | To achieve the functionality you've described in a console application in C#, you can start by using a loop to repeatedly read user input until the program exits. When the user enters a command, you can parse the command and its arguments to determine how to respond.
Below is a complete example that implements this lo... | 43,907 | [
{
"from": "human",
"value": "How would I go upon detecting input for a console application in C#?\nLet's say for example I want the console application to start up by writing:\nWelcome To Food Hut\n(cursor to type stuff here after the first line)\nI would want the console application to detect two commands:... |
When I first started programming, I wrote everything in main. But as I learned, I tried to do as little as possible in my main() methods.
But where do you decide to give the other Class/Method the responsibility to take over the program from main()? How do you do it?
I've seen many ways of doing it, like this:
class Ma... | Great question! Deciding what to put in the `main()` method versus what to delegate to other classes or methods is an important aspect of writing clean, maintainable, and scalable code. Here are some guidelines and best practices to help you determine how to structure your application:
### What Should Be in `main()`
... | 43,008 | [
{
"from": "human",
"value": "When I first started programming, I wrote everything in main. But as I learned, I tried to do as little as possible in my main() methods.\nBut where do you decide to give the other Class/Method the responsibility to take over the program from main()? How do you do it?\nI've seen... |
I have noticed that our VMWare VMs often have the incorrect time on them. No matter how many times I reset the time they keep on desyncing.
Has anyone else noticed this? What do other people do to keep their VM time in sync?
Edit: These are CLI linux VMs btw..
| Yes, time desynchronization issues are quite common with VMs, including those running Linux. Here are some steps and best practices to help keep the time in sync on your VMware Linux VMs:
### 1. Use NTP (Network Time Protocol)
The most reliable way to ensure time synchronization on your Linux VMs is to configure NTP.... | 42,297 | [
{
"from": "human",
"value": "I have noticed that our VMWare VMs often have the incorrect time on them. No matter how many times I reset the time they keep on desyncing.\nHas anyone else noticed this? What do other people do to keep their VM time in sync?\nEdit: These are CLI linux VMs btw..\n"
},
{
... |
I have a web application that uses the current version of JQuery that needs to get some JSON objects back from a REST web service. I'm using the following call to $.getJSON:
$.getJSON("http://localhost:17245/Service.svc/?format=json", function(data) {alert(data.id);});
This call works fine in IE7 and I can call the ser... | Hi James,
It looks like you are facing an issue with making AJAX calls in Firefox using jQuery. Here are a few potential reasons for the problem, along with steps you can take to troubleshoot and fix the issue:
### 1. Cross-Origin Resource Sharing (CORS)
If you're making requests from a different origin (in this case... | 45,088 | [
{
"from": "human",
"value": "I have a web application that uses the current version of JQuery that needs to get some JSON objects back from a REST web service. I'm using the following call to $.getJSON:\n$.getJSON(\"http://localhost:17245/Service.svc/?format=json\", function(data) {alert(data.id);});\nThis ... |
I'm working on an application controller for a program that is spitting text directly to /dev/tty.
This is a production application controller that must be able to catch all text going to the terminal. Generally, this isn't a problem. We simply redirect stdout and stderr. This particular application is making direct ca... | Catching output that is directly sent to `/dev/tty` can be challenging, especially when the application is using shell commands like `echo` to send text to the terminal. Since it’s not using standard output (stdout) or standard error (stderr) in a conventional way, your application controller has to find an alternative... | 42,543 | [
{
"from": "human",
"value": "I'm working on an application controller for a program that is spitting text directly to /dev/tty.\nThis is a production application controller that must be able to catch all text going to the terminal. Generally, this isn't a problem. We simply redirect stdout and stderr. This ... |
I am testing the UI of my ASP.Net Web Forms app using NUnit/Watin. I understand the high level concepts around TDD, Unit Testing, integration testing etc, but have not had much of a chance to put them to use until now.
So, when I am testing the validation logic on a data entry form, should I be writing one test that... | When deciding how to structure your tests for validation logic, it's important to consider several factors, including readability, maintainability, and the principles of unit testing. Let's analyze the two approaches you proposed:
### Option 1: Single Test for All Validations
```csharp
[Test]
public void Validation()... | 46,185 | [
{
"from": "human",
"value": "I am testing the UI of my ASP.Net Web Forms app using NUnit/Watin. I understand the high level concepts around TDD, Unit Testing, integration testing etc, but have not had much of a chance to put them to use until now. \nSo, when I am testing the validation logic on a data ent... |
We perform updates of large text files by writing new records to a temp file, then replacing the old file with the temp file. A heavily abbreviated version:
var tpath = Path.GetTempFileName();
try
{
using (var sf = new StreamReader(sourcepath))
using (var tf = new StreamWriter(tpath))
{
string line;... | Your approach for updating large text files while ensuring the original file remains untouched in the event of an exception is sound, but you're right to consider the potential issues with file deletion and properties.
### 1. Handling Deletion and Move Failures
You're correct that the `File.Delete(sourcepath)` could ... | 39,990 | [
{
"from": "human",
"value": "We perform updates of large text files by writing new records to a temp file, then replacing the old file with the temp file. A heavily abbreviated version:\nvar tpath = Path.GetTempFileName();\ntry\n{\n using (var sf = new StreamReader(sourcepath))\n using (var tf = new S... |
I have several aspx pages that can be opened either normally (full screen in browser), or called from another page as a popup (I am using Greybox, fwiw)
If the page is opened as a popup in Greybox, I would like to NOT display the master page content (which displays common top and left menus, etc).
As far as I know, the... | You can achieve this by using JavaScript to detect if the page is being opened in a popup and then conditionally hiding the elements from your master page. Here's a straightforward approach to implement this:
1. **Add a CSS class to hide the master page content**:
First, define a CSS class that hides the elements y... | 41,552 | [
{
"from": "human",
"value": "I have several aspx pages that can be opened either normally (full screen in browser), or called from another page as a popup (I am using Greybox, fwiw)\nIf the page is opened as a popup in Greybox, I would like to NOT display the master page content (which displays common top a... |
I have a core .NET application that needs to spawn an arbitrary number of subprocesses. These processes need to be able to access some form of state object in the core application.
What is the best technique? I'll be moving a large amount of data between processes (Bitmaps), so it needs to be fast.
| To enable your .NET application to spawn subprocesses and share state, particularly large amounts of data like Bitmaps, there are several strategies you can consider. Each has its advantages and trade-offs. Below are a few common techniques to achieve this:
### 1. Named Pipes
Named pipes provide a high-speed mechanism... | 43,368 | [
{
"from": "human",
"value": "I have a core .NET application that needs to spawn an arbitrary number of subprocesses. These processes need to be able to access some form of state object in the core application.\nWhat is the best technique? I'll be moving a large amount of data between processes (Bitmaps), so... |
I'd like to be able to call a function exposed by a VSTO addin from a cell in an excel worksheet. More specifically, if I have a VSTO function Foo() that returns "bar" I'd like to be able to write =Foo() in A1 which evaluates to "bar" on calculation.
Is this possible? What are the key steps I'd need to take?
The prospe... | To call a function from a VSTO (Visual Studio Tools for Office) add-in in Excel directly from a worksheet cell (like using `=Foo()`), you would typically use a custom Excel function. However, VSTO add-ins don’t provide a built-in way to directly expose .NET methods as Excel worksheet functions. Instead, you need to cre... | 44,039 | [
{
"from": "human",
"value": "I'd like to be able to call a function exposed by a VSTO addin from a cell in an excel worksheet. More specifically, if I have a VSTO function Foo() that returns \"bar\" I'd like to be able to write =Foo() in A1 which evaluates to \"bar\" on calculation.\nIs this possible? What ... |
I'm running Emacs 22.1.1 and IPython 0.9.1 on OS X and I'd like to be able to run lines/methods/snippets of Python code from my current buffer on demand inside an IPython interpreter.
What do I need to do to get this working?
| To run lines or snippets of Python code from your Emacs buffer into an IPython interpreter, you can set up Emacs to communicate with IPython through an Emacs package called `python.el` or by configuring `inf-python` mode for interactive sessions. Below are the steps to help you achieve that:
1. **Install IPython**: En... | 48,525 | [
{
"from": "human",
"value": "I'm running Emacs 22.1.1 and IPython 0.9.1 on OS X and I'd like to be able to run lines/methods/snippets of Python code from my current buffer on demand inside an IPython interpreter.\nWhat do I need to do to get this working?\n"
},
{
"from": "gpt",
"value": "To run ... |
Can any one give me a scripts (HTML/CSS/Javascript) that can reproduce this error on IE 7.0? I am trying to fix this bug in my page where I get this warning but could not exactly found the problem. Line number does not match with the source either.
I thought the better approach would be to create a bug and then work o... | Sure! To help you reproduce a common issue in Internet Explorer 7, I can provide you with a simple HTML/CSS/JavaScript code snippet that may trigger a JavaScript error or unexpected behavior in IE 7.
Here’s an example of code that attempts to use `addEventListener`, which is not supported in IE 7, potentially leading... | 45,436 | [
{
"from": "human",
"value": "Can any one give me a scripts (HTML/CSS/Javascript) that can reproduce this error on IE 7.0? I am trying to fix this bug in my page where I get this warning but could not exactly found the problem. Line number does not match with the source either. \nI thought the better approac... |
I've had a look at code.google.com, but I didn't find anywhere how to programatically make a search query to Google and get the results. Do you happen to know if this is possible, using some web services or any other way?
Of course, there's always the possibility to send a search query, get the HTML content of the resu... | As of my last knowledge update in October 2023, Google does not provide a public API for performing general web searches. This means there is no official way to programmatically send a search query and receive the results directly from Google in a structured format without resorting to web scraping.
However, there are... | 44,427 | [
{
"from": "human",
"value": "I've had a look at code.google.com, but I didn't find anywhere how to programatically make a search query to Google and get the results. Do you happen to know if this is possible, using some web services or any other way?\nOf course, there's always the possibility to send a sear... |
I have two tables in a MySQL database
urltracker with columns id and urlclicked
and urlreferrer with columns id, url_id and urlreferrer
the urltracker is really just a lookup table with the url_id column in the urlreferrer table being the link between the tables.
Example DDL:
CREATE TABLE urltracker (
id SE... | To achieve your goal of joining the two tables and getting the `urlclicked` along with the total number of referrers for each URL, you can use a SQL `JOIN` operation combined with an aggregate function like `COUNT()` to count the number of referrers.
Here’s how you can structure your SQL query:
```sql
SELECT
ut.... | 47,846 | [
{
"from": "human",
"value": "I have two tables in a MySQL database\nurltracker with columns id and urlclicked\nand urlreferrer with columns id, url_id and urlreferrer\nthe urltracker is really just a lookup table with the url_id column in the urlreferrer table being the link between the tables.\nExample DDL... |
I need to compare 2 strings in C# and treat accented letters the same as non-accented letters. For example:
string s1 = "hello";
string s2 = "héllo";
s1.Equals(s2, StringComparison.InvariantCultureIgnoreCase);
s1.Equals(s2, StringComparison.OrdinalIgnoreCase);
These 2 strings need to be the same (as far as my applica... | Yes, you can compare two strings in C# while treating accented letters the same as their non-accented counterparts by normalizing both strings and then performing a comparison. You can use the `String.Normalize` method to convert both strings into a form that allows you to compare them without accent differences. Here'... | 44,417 | [
{
"from": "human",
"value": "I need to compare 2 strings in C# and treat accented letters the same as non-accented letters. For example:\nstring s1 = \"hello\";\nstring s2 = \"héllo\";\n\ns1.Equals(s2, StringComparison.InvariantCultureIgnoreCase);\ns1.Equals(s2, StringComparison.OrdinalIgnoreCase);\n\nThese... |
How often does Akamai refresh cache?
We use Akamai to cache frequently accessed files. When uploading and overwriting files to the Akamai FTP, I can't see the new file reflected live.
Anybody have any experience with this?
| Akamai's caching behavior can vary based on several factors, including the specific configuration of your Akamai setup, the type of content you're delivering, and the caching rules you've implemented. Here are some important points to consider:
1. **Cache Expiration**: Akamai allows you to set cache expiration headers... | 45,490 | [
{
"from": "human",
"value": "How often does Akamai refresh cache?\nWe use Akamai to cache frequently accessed files. When uploading and overwriting files to the Akamai FTP, I can't see the new file reflected live.\nAnybody have any experience with this?\n"
},
{
"from": "gpt",
"value": "Akamai's ... |
I would like to inject binary data into an object in JavaScript. Is there a way to do this?
i.e.
var binObj = new BinaryObject('101010100101011');
Something to that effect. Any help would be great.
| In JavaScript, you can represent binary data using various types depending on your needs. One common way to handle binary data is by using `ArrayBuffer`, `Uint8Array`, or `Buffer` (in Node.js).
However, if you want to create a custom object that can hold binary data, you can do it like this:
### Using ArrayBuffer and... | 46,839 | [
{
"from": "human",
"value": "I would like to inject binary data into an object in JavaScript. Is there a way to do this? \ni.e.\nvar binObj = new BinaryObject('101010100101011');\n\nSomething to that effect. Any help would be great.\n"
},
{
"from": "gpt",
"value": "In JavaScript, you can represe... |
Are there any VS.NET plugins that will format a selection of code for printing or emailing and is also free?
| Yes, there are several free Visual Studio extensions that can help format code for printing or emailing. Here are a few options:
1. **Pretty Print**: This extension can format code selections and offers options for printing. You can select the code you want to format, and the tool can help present it in a more visuall... | 49,943 | [
{
"from": "human",
"value": "Are there any VS.NET plugins that will format a selection of code for printing or emailing and is also free?\n"
},
{
"from": "gpt",
"value": "Yes, there are several free Visual Studio extensions that can help format code for printing or emailing. Here are a few optio... |
Can I get the LAST INSERT ID() for a compound key in MySQL?
| In MySQL, the `LAST_INSERT_ID()` function retrieves the last automatically generated `AUTO_INCREMENT` value. However, it works specifically for single-column `AUTO_INCREMENT` keys. If your table has a compound primary key (a primary key consisting of multiple columns), the `LAST_INSERT_ID()` function will not directly ... | 45,900 | [
{
"from": "human",
"value": "Can I get the LAST INSERT ID() for a compound key in MySQL?\n"
},
{
"from": "gpt",
"value": "In MySQL, the `LAST_INSERT_ID()` function retrieves the last automatically generated `AUTO_INCREMENT` value. However, it works specifically for single-column `AUTO_INCREMENT`... |
I'm working on a canvas app embedded in a page. I have it so you can zoom into the drawing with the mousewheel but unfortunately this scrolls the page as it is part of an article.
Is it possible to prevent mousewheel scrolling on the window when I'm mousewheeling on a dom element?!
| Yes, it is possible to prevent the default scrolling behavior of the mouse wheel when you are interacting with a specific DOM element, such as a canvas in your case. You can do this by adding an event listener for the `wheel` event on the specific DOM element and calling `event.preventDefault()` to stop the page from s... | 47,282 | [
{
"from": "human",
"value": "I'm working on a canvas app embedded in a page. I have it so you can zoom into the drawing with the mousewheel but unfortunately this scrolls the page as it is part of an article.\nIs it possible to prevent mousewheel scrolling on the window when I'm mousewheeling on a dom eleme... |
I have a problem with simple c++ programs...
I would like to install a program, but always have the error like "c++ compiler is unable to create executables"...
Now I tried to compile a simple "hello world" program, but I get errors as I would if I compile a c++ program with a c compiler ("`cout' undeclared"... althou... | It sounds like you're encountering a few different issues related to your C++ compiler setup. Let's break down potential causes and solutions for the problems you've described.
### 1. C++ Compiler Setup
First, ensure that `g++` is properly installed and configured on your machine. You can do this by running the follo... | 44,407 | [
{
"from": "human",
"value": "I have a problem with simple c++ programs... \nI would like to install a program, but always have the error like \"c++ compiler is unable to create executables\"...\nNow I tried to compile a simple \"hello world\" program, but I get errors as I would if I compile a c++ program w... |
A bit of background first:
I am using "base" code from a remote SVN repository, not under my control. The code is not tagged (yet), so I always need to keep up with the trunk.
For a number of reasons (the most important being that our local extensions to the code are of a "niche" nature, and intended to solve a speci... | In your situation, you want to maintain synchronization with a remote SVN repository while also tracking your local modifications independently. Here are a few approaches you could consider to help streamline this process:
### 1. **Use SVN Switch with Local Modifications**:
You can utilize the `svn switch` command to ... | 46,300 | [
{
"from": "human",
"value": "A bit of background first:\n\nI am using \"base\" code from a remote SVN repository, not under my control. The code is not tagged (yet), so I always need to keep up with the trunk. \nFor a number of reasons (the most important being that our local extensions to the code are of a... |
I need to retrieve the browser and OS through php coding.
I had used $_SERVER['HTTP_USER_AGENT'], but its shows the following
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; IEMB3)
How can I separate the browser and OS from the above received value?
Please guide me..
Thanks i... | To retrieve and separate the browser and operating system information from the `$_SERVER['HTTP_USER_AGENT']` string in PHP, you can use regular expressions or string functions to parse the user agent string.
Here’s a basic approach to extracting the browser and OS from the user agent string:
```php
function getBrowse... | 45,644 | [
{
"from": "human",
"value": "I need to retrieve the browser and OS through php coding.\nI had used $_SERVER['HTTP_USER_AGENT'], but its shows the following \nMozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; IEMB3)\n\nHow can I separate the browser and OS from the abo... |
In a stylesheet i have:
* HTML BODY
{
padding-right: 0px;
padding-left: 0px;
padding-bottom: 25px;
padding-top: 190px;
}
* HTML #maincontent
{
width: 100%;
height: 100%;
}
i know that a . means class and a # means applied to the id, but what does ... | In CSS, the selector `* HTML` is a type of selector that applies styles to certain elements within a specific context.
- The `*` is the universal selector, which selects all elements.
- `HTML` refers specifically to the `<html>` element.
So, the combination `* HTML` means "select all elements that are descendants of ... | 49,636 | [
{
"from": "human",
"value": "In a stylesheet i have:\n * HTML BODY\n {\n padding-right: 0px;\n padding-left: 0px;\n padding-bottom: 25px;\n padding-top: 190px;\n }\n * HTML #maincontent\n {\n width: 100%;\n height: 100%;\n }\n\ni know that a . mean... |
So I have been working on a small web application (site) for a group of friends of mine and have come to the realization that things need to change. The application has two faces to it
a public facing side that serves dynamic data to visitors and non admins, and
an admin side where admins can update or create the d... | Migrating your application to a single ASP.NET MVC project while separating your admin and public-facing functionalities is a good approach, especially for maintaining organization and security. Here's a breakdown of how you can effectively structure your application to achieve this separation.
### Structure Overview
... | 43,529 | [
{
"from": "human",
"value": "So I have been working on a small web application (site) for a group of friends of mine and have come to the realization that things need to change. The application has two faces to it \n\na public facing side that serves dynamic data to visitors and non admins, and \nan admin ... |
Hopefully an easy question, but I'd quite like a technical answer to this!
What's the difference between:
i = 4
and
Set i = 4
in VBA? I know that the latter will throw an error, but I don't fully understand why.
| In VBA (Visual Basic for Applications), there is a key difference between using the assignment operator `=` and the `Set` keyword, which primarily relates to how they handle object references versus simple data types.
1. **i = 4**:
- This line assigns the integer value `4` to the variable `i`. In VBA, when you are ... | 47,311 | [
{
"from": "human",
"value": "Hopefully an easy question, but I'd quite like a technical answer to this!\nWhat's the difference between:\ni = 4\n\nand\nSet i = 4\n\nin VBA? I know that the latter will throw an error, but I don't fully understand why.\n"
},
{
"from": "gpt",
"value": "In VBA (Visua... |
I can not distinguish the difference between aggregating and holding. What does it mean in terms of, let`s say, C++?
I suppose when the object of class A holds (or instantiates) objects of class B, it uses it to perform some functions by itself.
For example:
class A {
int state;
public:
A(int s): state(s) {}
int... | You're correct in your understanding of the difference between holding (or composition) and aggregation in the context of object-oriented programming. Here's a brief clarification of these concepts, especially in the context of C++:
### Composition vs. Aggregation
- **Composition**: This is a "has-a" relationship whe... | 45,217 | [
{
"from": "human",
"value": "I can not distinguish the difference between aggregating and holding. What does it mean in terms of, let`s say, C++?\nI suppose when the object of class A holds (or instantiates) objects of class B, it uses it to perform some functions by itself.\nFor example:\nclass A {\n int s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.