instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I'm working on a eclipse plug-in and I've tried to create another test project seperate from the plug-in. The reason I do this is to not let the plug-in depend on jUnit when it is exported. However, I can't access the Eclipse Plug-in API when I do the testing. Whenever I try to add Plug-in dependencies the import list ... | When working with Eclipse plug-ins, it’s common to create a separate test project to avoid adding test dependencies directly to the plug-in itself. However, as you’ve noticed, this can create issues when trying to access the Eclipse Plug-in API from the test project. To resolve this and correctly set up your test proje... | 28,562 | [
{
"from": "human",
"value": "I'm working on a eclipse plug-in and I've tried to create another test project seperate from the plug-in. The reason I do this is to not let the plug-in depend on jUnit when it is exported. However, I can't access the Eclipse Plug-in API when I do the testing. Whenever I try to ... |
Let's say you got a file containing texts (from 1 to N) separated by a $
How can a slit the file so the end result is N files?
text1 with newlines $
text2 $etc... $
textN
I'm thinking something with awk or sed but is there any available unix app that already perform that kind of task?
| You can achieve this task using several Unix command-line utilities, including `awk`, `sed`, and `split`. However, for your specific case of splitting a file into multiple files based on a delimiter (`$`), `awk` is a good choice as it allows you to specify how to process input text.
Here's how you can do it with `awk`... | 34,838 | [
{
"from": "human",
"value": "Let's say you got a file containing texts (from 1 to N) separated by a $ \nHow can a slit the file so the end result is N files? \n\ntext1 with newlines $\n text2 $etc... $\n textN\n\nI'm thinking something with awk or sed but is there any available unix app that already perfo... |
I have a SQL Server 2000 install on a server that I am having weird connection issues with.
Using SSMS I can't connect to it using an Alias I have setup on Configuration Manager. The Alias is set to use TCPIP which is the first protocol in the order below shared memory. If I use the exact same server name I put int... | It sounds like you're experiencing a connection issue with your SQL Server 2000 instance when using an alias in SQL Server Configuration Manager. Since you can connect using the server name directly but not through the alias, there are several things you might want to check:
1. **Alias Configuration**: Double-check th... | 33,055 | [
{
"from": "human",
"value": "I have a SQL Server 2000 install on a server that I am having weird connection issues with. \nUsing SSMS I can't connect to it using an Alias I have setup on Configuration Manager. The Alias is set to use TCPIP which is the first protocol in the order below shared memory. If ... |
In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with inheritance?
| In Java, access modifiers control the visibility and accessibility of classes, interfaces, methods, and variables. The four main access modifiers are:
1. **public**
2. **protected**
3. **default** (also known as package-private)
4. **private**
Here are clear guidelines on when to use each access modifier:
### 1. **p... | 30,553 | [
{
"from": "human",
"value": "In Java, are there clear rules on when to use each of access modifiers, namely the default (package private), public, protected and private, while making class and interface and dealing with inheritance?\n"
},
{
"from": "gpt",
"value": "In Java, access modifiers cont... |
I need a basic pdf generator that'll let me toss some images and text into a pdf file. The ability to have some basic drawing commands (lines and so forth) would also be a plus.
I did read through this question, but I really don't need a report generator and most of the responses there seemed like real overkill for w... | If you’re looking for a simple PDF generator in Python that allows you to add text, images, and some basic drawing commands, you might want to check out the `reportlab` library. It's lightweight and gives you enough control for basic PDF creation without the complexity of full-fledged report generation tools.
### Ins... | 34,435 | [
{
"from": "human",
"value": "I need a basic pdf generator that'll let me toss some images and text into a pdf file. The ability to have some basic drawing commands (lines and so forth) would also be a plus.\nI did read through this question, but I really don't need a report generator and most of the respo... |
I'm developing a webapp where the user is given the chance to upload his resume in pdf format. I'm using NHibernate as a data mapper and MS SQL SERVER 2005.
I want to be able to save the .pdf file to a given table... any ideas?
Thank you very much!
| Certainly! To save a PDF file to a table in SQL Server using NHibernate, you typically have two approaches:
1. **Storing the PDF as a BLOB in the database**: You can save the PDF file directly in the database using a `VARBINARY` column.
2. **Storing the PDF file on the filesystem** and saving the file path or URL ... | 24,984 | [
{
"from": "human",
"value": "I'm developing a webapp where the user is given the chance to upload his resume in pdf format. I'm using NHibernate as a data mapper and MS SQL SERVER 2005.\nI want to be able to save the .pdf file to a given table... any ideas?\nThank you very much!\n"
},
{
"from": "gpt... |
I've got a big big code base that includes two main namespaces: the engine and the application.
The engine defines a vector3 class as a typedef of another vector3 class, with equality operators that sit in the engine namespace, not in the vector3 class. I added a class to the application that also had equality opera... | It sounds like you're dealing with some subtleties of name lookup and operator overloading in C++. The behavior you're experiencing can arise from a few different scenarios involving argument-dependent lookup (ADL), scope resolution, and potential ambiguities introduced by your custom operators.
Let's break down the p... | 31,278 | [
{
"from": "human",
"value": "I've got a big big code base that includes two main namespaces: the engine and the application. \nThe engine defines a vector3 class as a typedef of another vector3 class, with equality operators that sit in the engine namespace, not in the vector3 class. I added a class to th... |
Can someone illustrate what really is the difference between the two?
| Of course! However, I need to know which two things you would like me to compare. Could you please specify what you are referring to? | 38,287 | [
{
"from": "human",
"value": "Can someone illustrate what really is the difference between the two?\n"
},
{
"from": "gpt",
"value": "Of course! However, I need to know which two things you would like me to compare. Could you please specify what you are referring to?"
}
] |
I've been thinking of ways of providing syntactic sugar for a framework I have been working on. I want to deal with Immitable objects exclusively.
Say I have an immutable object and wish to create a modified version of it. Would, in your view, a non-instantiable class with a single static factory method break OO princi... | Your approach of using a non-instantiable class with a static factory method for creating modified versions of immutable objects (like strings) certainly provides a clear and concise way to apply transformations. However, there are both benefits and potential drawbacks to consider in terms of object-oriented principles... | 34,182 | [
{
"from": "human",
"value": "I've been thinking of ways of providing syntactic sugar for a framework I have been working on. I want to deal with Immitable objects exclusively.\nSay I have an immutable object and wish to create a modified version of it. Would, in your view, a non-instantiable class with a si... |
We happily use SVN for SCM at work. Currently I've got our binary assets in the same SVN repository as our code. SVN supports very large files (it transmits them 'streamily' to keep memory usage sane), but it makes everything SLOOWWWWW. I'm ok with slow asset versioning, but slow text operations isn't really accepta... | Storing binary assets alongside code in a single SVN repository can indeed lead to performance issues, especially as the size and number of binary files grow. Here are some recommendations you could consider to improve your situation:
### 1. Separate Repository for Assets
**Advantages:**
- **Performance:** Keeping bin... | 33,795 | [
{
"from": "human",
"value": "We happily use SVN for SCM at work. Currently I've got our binary assets in the same SVN repository as our code. SVN supports very large files (it transmits them 'streamily' to keep memory usage sane), but it makes everything SLOOWWWWW. I'm ok with slow asset versioning, but ... |
I want to check if a variable has a valid year using a regular expression. Reading the bash manual I understand I could use the operator =~
Looking at the example below, I would expect to see "not OK" but I see "OK". What am I doing wrong?
i="test"
if [ $i=~"200[78]" ]
then
echo "OK"
else
echo "not OK"
fi
| The issue in your Bash code is due to a syntax error in the condition that you're using to check the variable against the regular expression.
In Bash, when you want to use the `=~` operator to check if a string matches a regular expression, you should use the `[[ ... ]]` construct instead of `[ ... ]`. The `[[ ... ]]... | 36,243 | [
{
"from": "human",
"value": "I want to check if a variable has a valid year using a regular expression. Reading the bash manual I understand I could use the operator =~\nLooking at the example below, I would expect to see \"not OK\" but I see \"OK\". What am I doing wrong?\ni=\"test\"\nif [ $i=~\"200[78]\" ... |
How do you manage development and deployment of a n-tier system that's made up of multiple websites, desktop applications, web services and databases that have a mix of dependencies?
Assume that you have a continuous integration environment with source control and automated builds.
| Managing the development and deployment of an n-tier system composed of multiple websites, desktop applications, web services, and databases with mixed dependencies can be a complex task. Below is a structured approach to streamline the process, leveraging the continuous integration (CI) environment you already have in... | 31,392 | [
{
"from": "human",
"value": "How do you manage development and deployment of a n-tier system that's made up of multiple websites, desktop applications, web services and databases that have a mix of dependencies?\nAssume that you have a continuous integration environment with source control and automated bui... |
As a web developer, a number of the projects I work on fall under government umbrellas and hence are subject to 508 Accessibility laws, and sometimes W3C accessibility guidelines. To what extent can JavaScript be used while still meeting these requirements?
Along these lines, to what extent is JavaScript, specifically ... | When developing web applications that need to comply with Section 508 Accessibility requirements and the W3C Web Content Accessibility Guidelines (WCAG), JavaScript can be used effectively if implemented thoughtfully. Here are some key points to consider regarding the use of JavaScript, particularly AJAX and jQuery, wh... | 33,028 | [
{
"from": "human",
"value": "As a web developer, a number of the projects I work on fall under government umbrellas and hence are subject to 508 Accessibility laws, and sometimes W3C accessibility guidelines. To what extent can JavaScript be used while still meeting these requirements?\nAlong these lines, t... |
we're currently generating all our official documents using XSL-FO transformation using .xml files as input and generating .pdfs & basically all the content within these .xml's is either plain text or xhtml. This works perfectly fine for every-day use-cases, but some of our users refer to Microsoft Excel files which ou... | Handling Microsoft Excel files in an XSL-FO driven document generation system can indeed be challenging, especially when you're looking for a solution that maintains text searchability and integrates smoothly with your existing processes. Here are some strategies you might consider:
1. **Export to CSV or TSV**: If the... | 34,199 | [
{
"from": "human",
"value": "we're currently generating all our official documents using XSL-FO transformation using .xml files as input and generating .pdfs & basically all the content within these .xml's is either plain text or xhtml. This works perfectly fine for every-day use-cases, but some of our user... |
I'm needing to script my build. I'm using MSBUILD because of it's integration with VS.net. I am trying to copy some files from the build environment to the deployment folder. I'm using the copy task of MSBuild. But instead of copying the directory tree as I would expect. it copies all the contents into a single folder... | It looks like you're trying to copy an entire directory structure from the `Source` folder to the `DeployPath`, but you're encountering an issue where the files are all being placed in a single folder rather than preserving their directory structure.
To achieve the desired behavior of copying the entire directory tre... | 35,231 | [
{
"from": "human",
"value": "I'm needing to script my build. I'm using MSBUILD because of it's integration with VS.net. I am trying to copy some files from the build environment to the deployment folder. I'm using the copy task of MSBuild. But instead of copying the directory tree as I would expect. it cop... |
Ok simple question. I have a JSF application, containing a login page. The problem is if the user loads the login page, leaves it for a while, then tries to login the session expires and a ViewExpiredException is thrown. I could redirect back to the login when this happens, but that isn't very smooth. How can I allow t... | To handle the situation where a user tries to log in after their session has expired without running into a `ViewExpiredException`, you can implement a couple of strategies to make the user experience smoother. Here are a few approaches you can consider:
### 1. Use Session Timeout Handling in Managed Beans
You can man... | 32,872 | [
{
"from": "human",
"value": "Ok simple question. I have a JSF application, containing a login page. The problem is if the user loads the login page, leaves it for a while, then tries to login the session expires and a ViewExpiredException is thrown. I could redirect back to the login when this happens, but ... |
how do i do the following, with an ASP.NET MVC UpdateModel? I'm trying to read in a space delimeted textbox data (exactly like the TAGS textbox in a new StackOverflow question, such as this) into the model.
eg.
<input type="Tags" type="text" id="Tags" name="Tags"/>
...
public class Question
{
public string Title ... | In ASP.NET MVC, the `UpdateModel` method directly binds the posted form data to your model properties. When you use `UpdateModel` and have a single string property (like your `Tags` property), it will bind the entire string input into that property.
To achieve the desired behavior of splitting the tags based on spaces... | 34,602 | [
{
"from": "human",
"value": "how do i do the following, with an ASP.NET MVC UpdateModel? I'm trying to read in a space delimeted textbox data (exactly like the TAGS textbox in a new StackOverflow question, such as this) into the model.\neg.\n<input type=\"Tags\" type=\"text\" id=\"Tags\" name=\"Tags\"/>\n\n... |
I'm teaching Java EE at the university, and this was a question a student asked. I said "no", but I wasn't really sure, so I thought I might ask you mighty developers. :)
Basically, what I'd like to do is to use entities if they were in my context: cat getters, setters, etc, so like normal POJOs. if I use an EJB using ... | Your inquiry touches on a common challenge in Java EE (Jakarta EE) development, particularly around the use of entities and their decoupling from the business logic. Let's unpack your question.
### Understanding Entity Usage in Java EE
In Java EE, entities are typically managed by the Java Persistence API (JPA) and r... | 32,535 | [
{
"from": "human",
"value": "I'm teaching Java EE at the university, and this was a question a student asked. I said \"no\", but I wasn't really sure, so I thought I might ask you mighty developers. :)\nBasically, what I'd like to do is to use entities if they were in my context: cat getters, setters, etc, ... |
So I have a UML type chart that documents the classes and the hierarchy of a development. Just don't know what you'd call it?
Any suggestions?
| It sounds like you're describing a **class diagram**. Class diagrams are a type of UML (Unified Modeling Language) diagram that depict the classes in a system and their relationships, including inheritance and associations. They are commonly used to show the structure of an object-oriented system.
If your diagram also... | 37,090 | [
{
"from": "human",
"value": "So I have a UML type chart that documents the classes and the hierarchy of a development. Just don't know what you'd call it?\nAny suggestions?\n"
},
{
"from": "gpt",
"value": "It sounds like you're describing a **class diagram**. Class diagrams are a type of UML (Un... |
When I drop a third-party control onto a visual design surface in Visual Studio, any library references required by the control are automatically added to my project. I have an inherited version of a third-party control that I've added to the toolbox. However, when I drag it onto a form, only some of the references to ... | When using inherited controls in Visual Studio, it's important to understand how Visual Studio manages references for third-party controls. Unlike standard controls, inherited controls may not always trigger the automatic addition of all required references to the project when dropped onto the design surface. Here’s wh... | 33,574 | [
{
"from": "human",
"value": "When I drop a third-party control onto a visual design surface in Visual Studio, any library references required by the control are automatically added to my project. I have an inherited version of a third-party control that I've added to the toolbox. However, when I drag it ont... |
When I update the .dlls in my C# ASP.Net application, the transition is handled gracefully and the users are allowed to finish their requests before the code is switched over to the new code.
My question is do the static variables reset when that is done or do they persist through the update (if of course the static ob... | In an ASP.NET application, when you update the `.dll` files (such as during a deployment or an application restart), the application domain is typically recycled. When this happens, all static variables and static objects are reset to their default state. The static fields are tied to the application domain, and when t... | 36,025 | [
{
"from": "human",
"value": "When I update the .dlls in my C# ASP.Net application, the transition is handled gracefully and the users are allowed to finish their requests before the code is switched over to the new code.\nMy question is do the static variables reset when that is done or do they persist thro... |
Here's a simple (hopefully) L10N question:
Do all locales want this format:
Sunday, Nov 23, 2008
with the weekday before the date, or do some locales want it after the date like this?
Nov 23, 2008, Sunday
| Date formats can vary significantly between different locales, and the placement of the weekday can also differ based on cultural preferences. Generally, many English-speaking locales, including the United States and Canada, typically place the day of the week before the date (e.g., "Sunday, Nov 23, 2008").
However, ... | 37,407 | [
{
"from": "human",
"value": "Here's a simple (hopefully) L10N question:\nDo all locales want this format: \nSunday, Nov 23, 2008\nwith the weekday before the date, or do some locales want it after the date like this?\nNov 23, 2008, Sunday\n"
},
{
"from": "gpt",
"value": "Date formats can vary si... |
We have a REST API which clients routinely POST and PUT data to. When they do this, sometimes they POST data which results in no change on our system. The POSTs and PUTs are well-formed, but they data they're sending is identical to the data in our database. When this happens, I've just found out that we're returni... | In the RESTful world, handling situations where a client attempts to POST or PUT data that does not change the state of the resource can be a bit nuanced, but it's important to choose a status code that accurately reflects the situation. Here's a breakdown of your options and a common approach:
### Recommended Status ... | 35,149 | [
{
"from": "human",
"value": "We have a REST API which clients routinely POST and PUT data to. When they do this, sometimes they POST data which results in no change on our system. The POSTs and PUTs are well-formed, but they data they're sending is identical to the data in our database. When this happen... |
I'm experiencing some problems with CSS and/or tables on my newly redesigned website. Because of the well known "100% div height"-issue, I have resorted to using tables as a structural element of the website. So it looks something like this:
HTML MARKUP:
<div id="header">...</div>
<table>
<tr>
<td><div id="main... | The issues you're experiencing with your table layout might stem from a combination of CSS rules and how different browsers handle table layouts. Here are some suggestions to troubleshoot and improve your layout without relying heavily on tables, which can lead to accessibility and responsiveness issues.
### Problems ... | 34,336 | [
{
"from": "human",
"value": "I'm experiencing some problems with CSS and/or tables on my newly redesigned website. Because of the well known \"100% div height\"-issue, I have resorted to using tables as a structural element of the website. So it looks something like this:\nHTML MARKUP:\n<div id=\"header\">.... |
when installing SQLServer2005 developer edition (not express) I created a named instance:
MYSERVERNAME/MYINSTANCENAME
Is it possible to
1) change the name of my named instance to default:
MYSERVERNAME
OR
2) create a new default instance (MYSERVERNAME as above).
any help would be appreciated!
| In SQL Server, changing the name of a named instance to a default instance (or vice versa) is not supported directly. However, you have two options to achieve your goal:
### Option 1: Create a New Default Instance
You cannot change the name of the existing named instance to a default instance, but you can create a ne... | 33,943 | [
{
"from": "human",
"value": "when installing SQLServer2005 developer edition (not express) I created a named instance:\nMYSERVERNAME/MYINSTANCENAME\n\nIs it possible to \n1) change the name of my named instance to default:\nMYSERVERNAME\n\nOR\n2) create a new default instance (MYSERVERNAME as above).\nany h... |
And how to fix it. I'd like to log every thrown exception for maintenance purpose.
| Logging exceptions is a common practice for maintaining applications and diagnosing issues. Here's how you can implement exception logging in a few different environments and programming languages:
### In Python
You can use the built-in `logging` module to log exceptions. Here's an example:
```python
import logging
... | 31,710 | [
{
"from": "human",
"value": "And how to fix it. I'd like to log every thrown exception for maintenance purpose.\n"
},
{
"from": "gpt",
"value": "Logging exceptions is a common practice for maintaining applications and diagnosing issues. Here's how you can implement exception logging in a few dif... |
I have used an update command to update the whole table in an Sql Server 2000 database by mistake. I was actually meaning to update just one row. Now all the 2000 rows contain the update. Is there a way to roll back this change?
| In SQL Server 2000, the ability to roll back a change depends on whether or not the update was part of a transaction and whether you have enabled transaction logging. Here are some steps you can follow to attempt to recover from the situation:
1. **Check if the Update was in a Transaction**:
- If you executed the u... | 34,688 | [
{
"from": "human",
"value": "I have used an update command to update the whole table in an Sql Server 2000 database by mistake. I was actually meaning to update just one row. Now all the 2000 rows contain the update. Is there a way to roll back this change?\n"
},
{
"from": "gpt",
"value": "In SQ... |
I'm trying to find some info on the best and most common RESTful url actions.
for example, what url do you use for displaying the details of an item, for editing the item, updating, etc.
/question/show/<whatever>
/question/edit/<whatever>
/question/update/<whatever> (this is the post back url)
/question/list (lists t... | When designing RESTful APIs, it’s important to adhere to the principles of REST and use a consistent structure for your URL endpoints. Here are some common conventions for RESTful URLs that correspond to standard actions on resources. Below is an example using a "question" resource:
### RESTful URL Conventions
1. **L... | 34,213 | [
{
"from": "human",
"value": "I'm trying to find some info on the best and most common RESTful url actions.\nfor example, what url do you use for displaying the details of an item, for editing the item, updating, etc.\n/question/show/<whatever>\n/question/edit/<whatever>\n/question/update/<whatever> (this is... |
I understand that creating too many threads in an application isn't being what you might call a "good neighbour" to other running processes, since cpu and memory resources are consumed even if these threads are in an efficient sleeping state.
What I'm interested in is this: How much memory (win32 platform) is being con... | When working with threads in a Win32 environment, the memory consumption of a thread does indeed include the stack memory allocated for the thread, but it's essential to understand the components that make up the total memory footprint.
1. **Thread Stack Size**: When you create a thread in Win32, it is assigned a stac... | 34,091 | [
{
"from": "human",
"value": "I understand that creating too many threads in an application isn't being what you might call a \"good neighbour\" to other running processes, since cpu and memory resources are consumed even if these threads are in an efficient sleeping state.\nWhat I'm interested in is this: H... |
I have a client-server application that uses .net remoting. The clients are in a LAN and i do not know their location in advance.
Sometimes we do file transfers and as an optimization I want to determine if a client is in fact on the same machine as the server (it is quite possible). In this case, I only need to do a F... | In a client-server application using .NET Remoting, you can determine if the client is on the same machine as the server by checking the remote client's IP address against the server's own IP address. Here's how you can achieve this:
1. **Obtain the Client's IP Address**: In the remote method implementation on the ser... | 31,578 | [
{
"from": "human",
"value": "I have a client-server application that uses .net remoting. The clients are in a LAN and i do not know their location in advance.\nSometimes we do file transfers and as an optimization I want to determine if a client is in fact on the same machine as the server (it is quite poss... |
Having recently produced an HTML/CSS/Javascript based report from various word and excel files sent to me I'm trying to work out how to do this better in future, ideally enabling non-technical users in the office to do many of the tasks currently handed to me.
There are a range of HTML editors out there but none of the... | To enable non-technical users to create HTML reports while maintaining the advanced features you need (like using Thickbox for tables), consider the following solutions:
### 1. **Content Management Systems (CMS) with Custom Plugins/Modules**
Using a CMS like **WordPress** or **Joomla** can allow non-technical users t... | 27,404 | [
{
"from": "human",
"value": "Having recently produced an HTML/CSS/Javascript based report from various word and excel files sent to me I'm trying to work out how to do this better in future, ideally enabling non-technical users in the office to do many of the tasks currently handed to me.\nThere are a range... |
I'm trying to delete a directory that contains XML files from a remote computer. My code compiles and runs fine, but when I go to get a list of XML files in the path I specify, it is not returning anything. Am I missing something permission wise?
I have ran it from my computer logged on as myself and from another comp... | Your code looks like it is mostly set up correctly for deleting XML files in a specified directory. However, you mentioned that it's not returning any files when you attempt to list them. Here are some potential issues you might consider checking:
1. **File Extension Filter**: In the line where you call `GetFiles(ext)... | 33,140 | [
{
"from": "human",
"value": "I'm trying to delete a directory that contains XML files from a remote computer. My code compiles and runs fine, but when I go to get a list of XML files in the path I specify, it is not returning anything. Am I missing something permission wise? \nI have ran it from my computer... |
When I changed the rankdir of my graph from LR to TD, my record nodes also changed their layout direction so they no longer look like a 'record'. I tried applying a separate rankdir to the nodes, but this had no effect.
How does one keep the record nodes with the correct layout?
digraph sample {
graph [rankdir=TD];
... | In Graphviz, when you change the `rankdir` attribute, the layout of the nodes will also change accordingly. For `rankdir=TD` (top-down), record nodes (which are usually represented in a left-right orientation by default) may not display as you expect when the graph direction is changed.
To maintain the visual represen... | 36,185 | [
{
"from": "human",
"value": "When I changed the rankdir of my graph from LR to TD, my record nodes also changed their layout direction so they no longer look like a 'record'. I tried applying a separate rankdir to the nodes, but this had no effect.\nHow does one keep the record nodes with the correct layout... |
Here's a silly fun question:
Let's say we have to perform a simple operation where we need half of the value of a variable. There are typically two ways of doing this:
y = x / 2.0;
// or...
y = x * 0.5;
Assuming we're using the standard operators provided with the language, which one has better performance?
I'm guessi... | The performance of the two operations (`y = x / 2.0` and `y = x * 0.5`) can vary based on the specific programming language, the version, and the underlying implementation of the language's arithmetic operations. Here’s a breakdown of the performance considerations and the differences across different languages:
### P... | 34,275 | [
{
"from": "human",
"value": "Here's a silly fun question:\nLet's say we have to perform a simple operation where we need half of the value of a variable. There are typically two ways of doing this:\ny = x / 2.0;\n// or...\ny = x * 0.5;\n\nAssuming we're using the standard operators provided with the languag... |
Let's say I'm running a simple server and have accept()ed a connection from a client.
What is the best way to tell when the client has disconnected? Normally, a client is supposed to send a close command, but what if it disconnects manually or loses network connection altogether? How can the server detect or handle thi... | Detecting a client disconnection in a server environment requires careful handling, especially when the disconnection is unexpected (e.g., network failure, client crash, etc.). Here are the most common methods to detect when a client has disconnected:
1. **Read Operations**: One of the simplest methods is to continuou... | 34,793 | [
{
"from": "human",
"value": "Let's say I'm running a simple server and have accept()ed a connection from a client.\nWhat is the best way to tell when the client has disconnected? Normally, a client is supposed to send a close command, but what if it disconnects manually or loses network connection altogethe... |
What's the best cross-platform way to get file creation and modification dates/times, that works on both Linux and Windows?
| To retrieve file creation and modification dates/times in a cross-platform manner that works on both Linux and Windows, you can use Python's built-in libraries. Specifically, the `os` and `stat` modules provide a way to access file attributes in a platform-independent way.
Here's an example of how to get the creation ... | 33,692 | [
{
"from": "human",
"value": "What's the best cross-platform way to get file creation and modification dates/times, that works on both Linux and Windows?\n"
},
{
"from": "gpt",
"value": "To retrieve file creation and modification dates/times in a cross-platform manner that works on both Linux and... |
I want to play around a bit with FLASH for app development. I'm looking for a good IDE for that. Someone suggested Flash Develop.
| FlashDevelop is indeed a popular choice for Flash and ActionScript development. It's a free and open-source IDE that's lightweight and tailored specifically for Flash and ActionScript development. Here are some of its key features:
1. **Syntax Highlighting**: It offers syntax highlighting for ActionScript, Haxe, and o... | 35,711 | [
{
"from": "human",
"value": "I want to play around a bit with FLASH for app development. I'm looking for a good IDE for that. Someone suggested Flash Develop.\n"
},
{
"from": "gpt",
"value": "FlashDevelop is indeed a popular choice for Flash and ActionScript development. It's a free and open-so... |
Given a FieldInfo object and an object, I need to get the actual bytes representation of the field. I know that the field is either int,Int32,uint,short etc.
How can I get the actual byte representation? BinaryFormatter.Serialize won't help, since it'll give me more information than I need (it also records type name et... | To get the byte representation of a field in an object, you can use a combination of reflection and the `BitConverter` class (for primitive types like `int`, `short`, etc.). The `FieldInfo` object allows you to retrieve the value of the field from your object, and then you can convert that value into bytes.
Here's how... | 30,812 | [
{
"from": "human",
"value": "Given a FieldInfo object and an object, I need to get the actual bytes representation of the field. I know that the field is either int,Int32,uint,short etc.\nHow can I get the actual byte representation? BinaryFormatter.Serialize won't help, since it'll give me more information... |
I'm trying to run some python code under Apache 2.2 / mod_python 3.2.8. Eventually the code does os.fork() and spawns 2 separate long-run processes. Each of those processes has to create a separate instance of a class in order to avoid any possible collision in the parallel flow.
class Foo(object):
pass
kidprocs =... | The behavior you're observing, where both subprocesses appear to reference the same `Foo` object memory address, is a common confusion when using `os.fork()` in Python. Here's a detailed explanation of why this happens and how you can work with it effectively:
### Understanding `os.fork()`
When you call `os.fork()`, ... | 31,875 | [
{
"from": "human",
"value": "I'm trying to run some python code under Apache 2.2 / mod_python 3.2.8. Eventually the code does os.fork() and spawns 2 separate long-run processes. Each of those processes has to create a separate instance of a class in order to avoid any possible collision in the parallel flow... |
Considering the criteria listed below, which of Python, Groovy or Ruby would you use?
Criteria (Importance out of 10, 10 being most important)
Richness of API/libraries available (eg. maths, plotting, networking) (9)
Ability to embed in desktop (java/c++) applications (8)
Ease of deployment (8)
Ability to interface wi... | Based on your specified criteria, here's an analysis of Python, Groovy, and Ruby:
### 1. Richness of API/Libraries available (9)
- **Python**: Has an extensive set of libraries for various domains (e.g., NumPy, Pandas, Matplotlib for math and plotting, Requests for networking). It excels in data science and machine le... | 28,469 | [
{
"from": "human",
"value": "Considering the criteria listed below, which of Python, Groovy or Ruby would you use?\n\nCriteria (Importance out of 10, 10 being most important)\nRichness of API/libraries available (eg. maths, plotting, networking) (9)\nAbility to embed in desktop (java/c++) applications (8)\n... |
I am looking for more information about the minimum requirements needed for a visitor to successfully stream a 1 Mbps 640x360 H.264-encoded video. I know that the user needs the latest Flash 9 version. I am looking for the minimum requirements for their computers.
We want to switch to this codec for our videos, but do ... | Streaming video effectively involves several factors, including the codec used, video resolution, bitrate, and the hardware specifications of the user’s device. For your specific case—streaming a 640x360 H.264-encoded video at 1 Mbps—here are some considerations and minimum requirements:
### Minimum System Requirement... | 28,577 | [
{
"from": "human",
"value": "I am looking for more information about the minimum requirements needed for a visitor to successfully stream a 1 Mbps 640x360 H.264-encoded video. I know that the user needs the latest Flash 9 version. I am looking for the minimum requirements for their computers.\nWe want to sw... |
There is a question I have been wondering about for ages and I was hoping someone could give me an answer to rest my mind.
Let's assume that I have an input stream (like a file/socket/pipe) and want to parse the incoming data. Let's assume that each block of incoming data is split by a newline, like most common interne... | You've raised an important question that comes up frequently when designing systems to parse data streams that are segmented by a delimiter. The challenge lies in effectively managing the memory and ensuring that you don't lose any data. Let's consider a few strategies to tackle this problem, including some potential t... | 32,480 | [
{
"from": "human",
"value": "There is a question I have been wondering about for ages and I was hoping someone could give me an answer to rest my mind.\nLet's assume that I have an input stream (like a file/socket/pipe) and want to parse the incoming data. Let's assume that each block of incoming data is sp... |
I have a makefile template to compile a single DLL (for a plugin system).
The makefile of the user looks like this:
EXTRA_SRCS=file1 file2
include makefile.in
In the makefile.in I have:
plugin.dll: plugin.os $(patsubst %,%.os,$(EXTRA_SRCS))
Where plugin.os is the main C++ file to be compiled. Btw, the files ending is... | To enhance your Makefile so that it dynamically adds dependencies for `plugin.os` based on the existence of the header files mentioned in `EXTRA_SRCS`, you can use a conditional check within the Makefile to determine if the files exist before including them as dependencies.
Here’s a modified version of your Makefile t... | 33,705 | [
{
"from": "human",
"value": "I have a makefile template to compile a single DLL (for a plugin system).\nThe makefile of the user looks like this:\nEXTRA_SRCS=file1 file2\ninclude makefile.in\n\nIn the makefile.in I have:\nplugin.dll: plugin.os $(patsubst %,%.os,$(EXTRA_SRCS))\n\nWhere plugin.os is the main ... |
I just want to know the best way to emulate a C# style enumeration in Ruby.
| In Ruby, while there isn't a built-in enumeration type like in C#, you can effectively emulate C# style enumerations using a combination of classes and modules. Here are several approaches you can use:
### 1. Using a Module with Constants
The simplest way to create an enumeration-like structure is to define a module ... | 31,871 | [
{
"from": "human",
"value": "I just want to know the best way to emulate a C# style enumeration in Ruby.\n"
},
{
"from": "gpt",
"value": "In Ruby, while there isn't a built-in enumeration type like in C#, you can effectively emulate C# style enumerations using a combination of classes and module... |
I've written a IE Toolbar in C# and everything is working fine except that when I open a child Windows Form from my toolbar, the tab key doesn't work on the child form to allow me to move from field to field.
The interesting part is that when I open my child form using form.showDialog() instead of form.show() the tabs... | It sounds like you're encountering issues with the keyboard focus and message routing when using `form.Show()` as opposed to `form.ShowDialog()`. The key difference between the two methods is that `ShowDialog()` opens the form as a modal dialog, which changes the way focus and message processing works. When using `Show... | 32,645 | [
{
"from": "human",
"value": "I've written a IE Toolbar in C# and everything is working fine except that when I open a child Windows Form from my toolbar, the tab key doesn't work on the child form to allow me to move from field to field.\nThe interesting part is that when I open my child form using form.sh... |
Basically I have a website. I have a properly setup sitemap so I assume Google knows about all of my pages. And I've seen on some sites, the search form leads to a page with the shell of the original site but the results are clearly provided by Google. Similar to codinghorror.com's search, however his results aren't... | What you're referring to is often called a "custom search engine" integration. This allows you to include Google Search functionality within your website while maintaining a level of customization and branding. Here's how you can achieve something similar to what you've described:
### 1. Use Google Custom Search Engin... | 33,845 | [
{
"from": "human",
"value": "Basically I have a website. I have a properly setup sitemap so I assume Google knows about all of my pages. And I've seen on some sites, the search form leads to a page with the shell of the original site but the results are clearly provided by Google. Similar to codinghorror... |
I recently inherited a VBA macro that needs to have validation logic added to it. I need to be able to determine if any characters in a text based cell are non ASCII characters (i.e. have a binary value > 0x7F). The cells may contain some carriage control values (particularly linefeeds) that need to be retained (so t... | To achieve your goal of checking for non-ASCII characters in a text-based cell in your VBA macro, you can loop through each character in the cell's content and verify whether its ASCII value exceeds 127 (0x7F). If you find any characters that are non-ASCII, you can display an error message to the user.
Here's an examp... | 32,920 | [
{
"from": "human",
"value": "I recently inherited a VBA macro that needs to have validation logic added to it. I need to be able to determine if any characters in a text based cell are non ASCII characters (i.e. have a binary value > 0x7F). The cells may contain some carriage control values (particularly ... |
I use URLLoader to load data into my Flex app (mostly XML) and my buddy who is doing the same thing mostly uses HTTPService. Is there a specific or valid reason to use on over the other?
| When working with Adobe Flex for loading data, both `URLLoader` and `HTTPService` can be used effectively, but they serve slightly different purposes and have different features. Here are some specific considerations for each:
### URLLoader
- **General Purpose**: `URLLoader` is a more general-purpose class that can lo... | 33,698 | [
{
"from": "human",
"value": "I use URLLoader to load data into my Flex app (mostly XML) and my buddy who is doing the same thing mostly uses HTTPService. Is there a specific or valid reason to use on over the other?\n"
},
{
"from": "gpt",
"value": "When working with Adobe Flex for loading data,... |
Is there a programmatic method to set CPU affinity for a process in c/c++ for the Linux operating system?
| Yes, you can set CPU affinity for a process in C/C++ on a Linux operating system using the `sched_setaffinity` function. This function allows you to specify which CPUs a process is allowed to run on.
Here's how you can do this:
1. Include the necessary headers.
2. Create a `cpu_set_t` structure to specify the desired... | 35,088 | [
{
"from": "human",
"value": "Is there a programmatic method to set CPU affinity for a process in c/c++ for the Linux operating system?\n"
},
{
"from": "gpt",
"value": "Yes, you can set CPU affinity for a process in C/C++ on a Linux operating system using the `sched_setaffinity` function. This fu... |
I want to know if i can create a custom google maps application,on which a placemarker continuously moves over the map accordingly as its latlongs are changing.
If yes...what technologies shall i be using for such a webapp??
can this be done with .NET....Ultimately if this is possible,i will have to use this webapp on ... | Yes, you can create a custom Google Maps application that displays a placemarker that moves according to changing latitude and longitude coordinates. You can definitely use .NET technologies to build this web application, and it can be hosted on a Red Hat Enterprise Linux (RHEL5) server using .NET Core or a similar fra... | 27,928 | [
{
"from": "human",
"value": "I want to know if i can create a custom google maps application,on which a placemarker continuously moves over the map accordingly as its latlongs are changing.\nIf yes...what technologies shall i be using for such a webapp??\ncan this be done with .NET....Ultimately if this is ... |
Background: Over the next month, I'll be giving three talks about or at least including LINQ in the context of C#. I'd like to know which topics are worth giving a fair amount of attention to, based on what people may find hard to understand, or what they may have a mistaken impression of. I won't be specifically talki... | It's great that you're planning to delve into LINQ in your upcoming talks! LINQ is a powerful feature of C#, but it can be a source of confusion for many developers, especially those who are new to it. Below are some topics that often lead to misunderstandings or difficulties, along with some suggestions on how to addr... | 30,850 | [
{
"from": "human",
"value": "Background: Over the next month, I'll be giving three talks about or at least including LINQ in the context of C#. I'd like to know which topics are worth giving a fair amount of attention to, based on what people may find hard to understand, or what they may have a mistaken imp... |
I have the following C++ code:
Char ^= 0xB3;
Char is a single character in a string. Is there an equivalent in VBScript?
| Yes, you can achieve a similar effect in VBScript by using the `Asc` and `Chr` functions to manipulate the character.
In C++, the expression `Char ^= 0xB3;` is performing a bitwise XOR operation with the character's ASCII value. To replicate this in VBScript, you will need to convert the character to its ASCII value,... | 36,769 | [
{
"from": "human",
"value": "I have the following C++ code:\nChar ^= 0xB3;\nChar is a single character in a string. Is there an equivalent in VBScript?\n"
},
{
"from": "gpt",
"value": "Yes, you can achieve a similar effect in VBScript by using the `Asc` and `Chr` functions to manipulate the char... |
private void activateRecords(long[] stuff) {
...
api.activateRecords(Arrays.asList(specIdsToActivate));
}
Shouldn't this call to Arrays.asList return a list of Longs? Instead it is returning a List<long[]>
public static <T> List<T> asList(T... a)
The method signature is consistent with the results, the v... | You're correct in your understanding that `Arrays.asList(stuff)` where `stuff` is of type `long[]` will not give you the desired `List<Long>`. Instead, it will create a `List<long[]>`, containing a single element, which is the entire array `stuff`.
This is because when you pass a primitive array (like `long[]`) to `Ar... | 33,276 | [
{
"from": "human",
"value": " private void activateRecords(long[] stuff) {\n ...\n api.activateRecords(Arrays.asList(specIdsToActivate));\n }\n\nShouldn't this call to Arrays.asList return a list of Longs? Instead it is returning a List<long[]>\npublic static <T> List<T> asList(T... a)\n\nThe metho... |
What are some good solutions for handling automatic web based software updates for windows forms projects? I am aware of microsoft one-click, but am not interested in it at this time.
| Handling automatic web-based software updates for Windows Forms applications can be accomplished through various methods, particularly when you're looking for alternatives to Microsoft's One-Click deployment. Here are some effective solutions you can consider:
### 1. **ClickOnce (Alternative Use)**:
While you menti... | 27,483 | [
{
"from": "human",
"value": "What are some good solutions for handling automatic web based software updates for windows forms projects? I am aware of microsoft one-click, but am not interested in it at this time.\n"
},
{
"from": "gpt",
"value": "Handling automatic web-based software updates for ... |
I have problems with how to design some classes. I have three classes. One superclass, and two subclasses.
One subclass (AnimatedCharacter) is made by flash, and is used to display the object on screen. The other (CharacterPhysics) is made by myself to extend the superclass.
The problem is that the object I use, is of... | Your scenario is a common design challenge when dealing with inheritance and composition in object-oriented design. Given that you have a superclass and two subclasses (`AnimatedCharacter` and `CharacterPhysics`), and you need to work with an `AnimatedCharacter` while also wanting to apply physics from `CharacterPhysic... | 34,169 | [
{
"from": "human",
"value": "I have problems with how to design some classes. I have three classes. One superclass, and two subclasses. \nOne subclass (AnimatedCharacter) is made by flash, and is used to display the object on screen. The other (CharacterPhysics) is made by myself to extend the superclass.\n... |
I have this as Main
int[] M ={ 10, 2, 30, 4, 50, 6, 7, 80 };
MyMath.Reverse(M);
for (int i = 0; i < M.Length; i++)
Console.WriteLine(M[i].ToString() + ", ");
After I created the class MyMath I made the Reverse method
public int Reverse(Array M)
{
int len = M.Length;
for (int i = 0; i < len / 2; i... | It looks like you're encountering a couple of issues with your `Reverse` method. Let's break down the problems and provide a corrected version.
1. **Method Signature and Parameter Type**: The `Reverse` method is currently defined to take an `Array` as a parameter. However, you're trying to treat the array as if it wer... | 34,333 | [
{
"from": "human",
"value": "I have this as Main\nint[] M ={ 10, 2, 30, 4, 50, 6, 7, 80 };\n\nMyMath.Reverse(M);\n\nfor (int i = 0; i < M.Length; i++)\n\n Console.WriteLine(M[i].ToString() + \", \");\n\n\nAfter I created the class MyMath I made the Reverse method \npublic int Reverse(Array M)\n {\n i... |
According to the PHP manual, in order to make code more portable, they recommend using something like the following for escaping data:
if (!get_magic_quotes_gpc()) {
$lastname = addslashes($_POST['lastname']);
} else {
$lastname = $_POST['lastname'];
}
I have other validation checks that I will be performing, ... | The code snippet you provided uses the deprecated `get_magic_quotes_gpc()` function to check if magic quotes are enabled, and conditionally applies `addslashes()` to escape the input data. However, this approach has several significant weaknesses in terms of security and best practices.
### Security Issues:
1. **Outda... | 34,949 | [
{
"from": "human",
"value": "According to the PHP manual, in order to make code more portable, they recommend using something like the following for escaping data:\nif (!get_magic_quotes_gpc()) {\n $lastname = addslashes($_POST['lastname']);\n} else {\n $lastname = $_POST['lastname'];\n}\n\nI have oth... |
The Custom Action is configured as follows:
Custom Action Name: MyCustomAction
VBScript Filename: <PathVar01>\MyFolder\MyVBSfile.vbs
ScriptFunction: MyFunction
Return Processing: Synchronous (Check exit code)
In-Script Execution: Immediate Execution
It is being executed via the following InstallScript code:
result = ... | The error you're encountering (Error 1720) typically indicates that there is a problem with the script itself or how it's being executed. Here are some common troubleshooting steps to diagnose and fix the issue:
1. **Check the VBScript File Path**: Ensure that the path `<PathVar01>\MyFolder\MyVBSfile.vbs` is being res... | 33,873 | [
{
"from": "human",
"value": "The Custom Action is configured as follows:\n\nCustom Action Name: MyCustomAction\nVBScript Filename: <PathVar01>\\MyFolder\\MyVBSfile.vbs\nScriptFunction: MyFunction\nReturn Processing: Synchronous (Check exit code)\nIn-Script Execution: Immediate Execution\n\nIt is being execu... |
What are the best ways of dealing with UTC Conversion and daylight saving times conversion. What are the problems and their solutions. All in C# .Net 2.0. Also any existing problems with this in .Net 2.0.
| Handling UTC and daylight saving time (DST) conversions in C# can be a complex task, especially in .NET Framework 2.0, which has limited built-in support for time zone handling compared to later versions. Here are some of the common problems you might encounter, along with potential solutions and best practices.
### C... | 30,375 | [
{
"from": "human",
"value": "What are the best ways of dealing with UTC Conversion and daylight saving times conversion. What are the problems and their solutions. All in C# .Net 2.0. Also any existing problems with this in .Net 2.0.\n"
},
{
"from": "gpt",
"value": "Handling UTC and daylight sav... |
I'm trying to implement an HTML Parsing web service as described in Chapter 23 of ASP.NET Unleashed (1st ed.) and this MSDN article. So far, so good! However, I do get an annoying warning when using wsdl.exe to generate the class:
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework,... | To ensure that your WSDL conforms to the WS-I Basic Profile v1.1, you need to follow certain guidelines when defining your web service's WSDL document. The warning you're seeing suggests that there's a potential issue with how your SOAP 1.1 binding is defined in the WSDL.
Here are some common steps to check and ensure... | 30,865 | [
{
"from": "human",
"value": "I'm trying to implement an HTML Parsing web service as described in Chapter 23 of ASP.NET Unleashed (1st ed.) and this MSDN article. So far, so good! However, I do get an annoying warning when using wsdl.exe to generate the class:\n\nMicrosoft (R) Web Services Description Lang... |
I have a sproc that returns a single line and column with a text, I need to set this text to a variable, something like:
declare @bla varchar(100)
select @bla = sp_Name 9999, 99989999, 'A', 'S', null
but of course, this code doesn't work...
thanks!
| To assign the result of a stored procedure to a variable in SQL Server, you generally have to use an approach involving a temporary table, table variable, or a different method since you can't directly assign the result of a stored procedure to a variable in a single step like you would with a SELECT statement.
Here’s... | 32,222 | [
{
"from": "human",
"value": "I have a sproc that returns a single line and column with a text, I need to set this text to a variable, something like:\ndeclare @bla varchar(100)\nselect @bla = sp_Name 9999, 99989999, 'A', 'S', null\n\nbut of course, this code doesn't work...\nthanks!\n"
},
{
"from": ... |
I have an XML document something like :::
<?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xml... | When working with XML that uses namespaces, such as the one you provided, you need to account for those namespaces in your XPath expressions. In your case, the `<Row>` elements are part of the `urn:schemas-microsoft-com:office:spreadsheet` namespace.
To match these elements in an XSLT transformation, you should define... | 35,208 | [
{
"from": "human",
"value": "I have an XML document something like :::\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?mso-application progid=\"Excel.Sheet\"?>\n<Workbook xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\"\n xmlns:o=\"urn:schemas-microsoft-com:office:office\"\n xmlns:... |
I'm working on trouble shooting an application under development that uses information from Active Directory in a multi-forest environment and I have the current problem down to figuring out if forest trusts are transitive, and if so under what conditions.
The setup: Using Active Directory 2003, ForestA has a two-way f... | You're correct in your understanding, and it’s a common area of confusion in Active Directory (AD) documentation regarding forest trusts.
1. **Transitive Nature of Forest Trusts**: In Active Directory, when we say that a trust is "transitive," it refers to the way trust is inherited within a single forest or hierarchy... | 33,620 | [
{
"from": "human",
"value": "I'm working on trouble shooting an application under development that uses information from Active Directory in a multi-forest environment and I have the current problem down to figuring out if forest trusts are transitive, and if so under what conditions.\nThe setup: Using Acti... |
Can anyone provide me with a link to good article about using Firebird.NET with a WinForms application? A simple google search did not yield good results - I am looking for a step-by-step guide which will help me to quickly a few things and am not sure the documentation is a good place to start.
Thanks in advance.
Anin... | While I cannot browse the web in real time to provide you with a direct link, I can help guide you through the process of using Firebird.NET with a WinForms application. Here’s a simplified step-by-step guide to help you get started:
### Step 1: Install Firebird Database
1. **Download Firebird**: Go to the [Firebird ... | 30,706 | [
{
"from": "human",
"value": "Can anyone provide me with a link to good article about using Firebird.NET with a WinForms application? A simple google search did not yield good results - I am looking for a step-by-step guide which will help me to quickly a few things and am not sure the documentation is a goo... |
Say I've got a client-side counter variable. When I send a request to the server, I send this variable's value, then increment it by one (for the next request to the server). The server keeps track of this counter independantly, and checks to make sure that the count sent by the client is 1 more than it's own (server-s... | To handle the situation where a communication error could cause the client and server to become out of sync, you can implement a few strategies to ensure that your counter remains consistent. Here are several approaches that could mitigate the risk of desynchronization:
### 1. Acknowledgment and Resend Mechanism
You ... | 31,533 | [
{
"from": "human",
"value": "Say I've got a client-side counter variable. When I send a request to the server, I send this variable's value, then increment it by one (for the next request to the server). The server keeps track of this counter independantly, and checks to make sure that the count sent by the... |
I am wondering how I can break up my index.php homepage to multiple php pages (i.e. header.php, footer.php) and build a working index.php page using those separate php pages. I know WordPress uses this with different functions like:
GetHeader();
GetFoodter();
But when I tried to use those functions, it errors. I am ... | To break up your `index.php` homepage into multiple PHP files like `header.php`, `footer.php`, and others, you can use the `include` or `require` statements in PHP. These statements allow you to include the contents of one PHP file into another, which is similar to what WordPress does with its `get_header()` and `get_f... | 30,985 | [
{
"from": "human",
"value": "I am wondering how I can break up my index.php homepage to multiple php pages (i.e. header.php, footer.php) and build a working index.php page using those separate php pages. I know WordPress uses this with different functions like:\nGetHeader();\nGetFoodter();\n\nBut when I tr... |
How (i.e. using which API) is the virtual keyboard opened on Symbian S60 5th edition? The documentation seems to lack information about this.
| On Symbian S60 5th Edition, you can open the virtual keyboard programmatically by using the `CAknTextEditor` class or similar text input classes provided in the platform.
Here's a simple way to open the virtual keyboard in your application:
1. **Create an instance of `CAknTextEditor`:** This class is used for text i... | 35,875 | [
{
"from": "human",
"value": "How (i.e. using which API) is the virtual keyboard opened on Symbian S60 5th edition? The documentation seems to lack information about this.\n"
},
{
"from": "gpt",
"value": "On Symbian S60 5th Edition, you can open the virtual keyboard programmatically by using the ... |
I am stuck building reports that will be generated by a custom application using the Crystal Reports 9.1.5 that comes with Visual Studio 2003. In addition to the editor being one of the most infuriating things I've ever had to work with I am also constantly hounded by the various gotchas having to do with their code g... | Working with Crystal Reports, especially older versions like 9.1.5 in Visual Studio 2003, can indeed be challenging. Fortunately, there are several resources and approaches you can use to get a better grasp of how to effectively use Crystal Reports for report generation.
### Online Tutorials and Documentation
1. **SA... | 34,461 | [
{
"from": "human",
"value": "I am stuck building reports that will be generated by a custom application using the Crystal Reports 9.1.5 that comes with Visual Studio 2003. In addition to the editor being one of the most infuriating things I've ever had to work with I am also constantly hounded by the vario... |
Here are two different questions but I think they are related.
When using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command hg outgoing.
When using Git, how do I find what changes a remote branch has prior to... | Both of your questions can be addressed by leveraging Git's powerful branching and comparison capabilities. Here’s how to find the committed changes you haven't pushed and check what changes a remote branch has before pulling.
### 1. Finding Local Changes Not Pushed to Remote
To see which commits you have made locall... | 32,943 | [
{
"from": "human",
"value": "Here are two different questions but I think they are related.\n\nWhen using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command hg outgoing.\nWhen using Git, how do I fi... |
I have a linq query and I am trying to put that in to a serializable object for a distributed caching (Velocity) but its failing due to a LINQ-to-SQL lazy list
like so
return from b in _datacontext.MemberBlogs
let cats = GetBlogCategories(b.MemberBlogID)
select new MemberBlogs
... | When using LINQ-to-SQL and trying to serialize objects containing `LazyList<T>`, you might encounter issues due to the way lazy loading works. The `LazyList<T>` likely contains references to objects that are not fully materialized at the time of serialization, which can cause serialization to fail.
Here are some strat... | 31,421 | [
{
"from": "human",
"value": "I have a linq query and I am trying to put that in to a serializable object for a distributed caching (Velocity) but its failing due to a LINQ-to-SQL lazy list\nlike so\n return from b in _datacontext.MemberBlogs\n let cats = GetBlogCategories(b.MemberBlogID)\... |
I have an XML Schema which I am parsing in JavaScript and then packing that as an object to pass to one of my backend servers.
The schema is like
<complexType name='Test'>
<sequence>
<element name='testField' type='string'/>
<element name='typeSpecificSetting' type='tns:TypeSpecific'/>
</sequ... | To construct your request object based on the XML Schema, you'll first need to determine the value of `typeSpecificSetting` from the `testField` and then use that value to decide which specific type (i.e., `ATYPE`, `BTYPE`, `CTYPE`, or `DTYPE`) to include in your request object.
Here's a step-by-step approach to achi... | 31,425 | [
{
"from": "human",
"value": "I have an XML Schema which I am parsing in JavaScript and then packing that as an object to pass to one of my backend servers. \nThe schema is like\n<complexType name='Test'>\n <sequence> \n <element name='testField' type='string'/>\n <element name='typeSpecifi... |
What tools are available to encrypt or password-protect a file stored on the IFS?
*integrated file-system, accessible from Windows
| To encrypt or password-protect files stored on the Integrated File System (IFS) in an IBM i environment that is accessible from Windows, you have several options. Here are some commonly used tools and methods:
### 1. **IBM i Operating System Encryption**
- **IBM i Navigator**: You can use the IBM i Navigator to man... | 31,928 | [
{
"from": "human",
"value": "What tools are available to encrypt or password-protect a file stored on the IFS?\n*integrated file-system, accessible from Windows\n"
},
{
"from": "gpt",
"value": "To encrypt or password-protect files stored on the Integrated File System (IFS) in an IBM i environmen... |
Has anyone ever given table columns the "fisheye" effect? Im talking about an expanding effect of the table columns when hovering the mouse over them. I'd love to see some code if anyone has tried this.
EDIT: ...or an accordian effect
| Yes, the "fisheye" effect or the "accordion" effect on table columns can be achieved using CSS and JavaScript (or just CSS for simpler effects). Below are two examples of how you can implement these effects.
### Fisheye Effect
The fisheye effect can be done using CSS transitions and transforms. When you hover over a ... | 28,556 | [
{
"from": "human",
"value": "Has anyone ever given table columns the \"fisheye\" effect? Im talking about an expanding effect of the table columns when hovering the mouse over them. I'd love to see some code if anyone has tried this.\nEDIT: ...or an accordian effect\n"
},
{
"from": "gpt",
"value... |
So the transparent background problem is solved. Now, every time I show the form (or have to have it repainted), I get a lot of flickering. Is there any way I can not update the screen until the paint event is complete, or any other way to stop the 1/2 second of flickering and flashing while all the objects are being... | You're right! Flickering is a common issue in Windows Forms, particularly when you are dealing with custom painting. The solution you mentioned—using double buffering—is an effective way to eliminate flickering during repaints.
In Windows Forms, double buffering can indeed be enabled at both the control level and the... | 34,763 | [
{
"from": "human",
"value": "So the transparent background problem is solved. Now, every time I show the form (or have to have it repainted), I get a lot of flickering. Is there any way I can not update the screen until the paint event is complete, or any other way to stop the 1/2 second of flickering and... |
I have a stored procedure that has a optional parameter, @UserID VARCHAR(50). The thing is, there are two ways to work with it:
Give it a default value of NULL, the have an IF...ELSE clause, that performs two different SELECT queries, one with 'WHERE UserID = @UserID' and without the where.
Give it a default value of ... | When considering the two approaches for handling an optional `@UserID` parameter in a stored procedure, let's break down the implications of each method in terms of performance and maintainability, especially in the context of SQL Server and with the additional information you provided:
### Option 1: Default Value of ... | 32,317 | [
{
"from": "human",
"value": "I have a stored procedure that has a optional parameter, @UserID VARCHAR(50). The thing is, there are two ways to work with it:\n\nGive it a default value of NULL, the have an IF...ELSE clause, that performs two different SELECT queries, one with 'WHERE UserID = @UserID' and wit... |
What is the "canonical" way to access the MessageContext from a PayloadEndpoint?
We are using PayloadEndpoint and AbstractMarshallingPayloadEndpoint which do not expose the MessageContext to their invoke / invokeinternal methods, but will now need to access the HTTP request parameters.
| In Spring Integration, when working with `PayloadEndpoint` and `AbstractMarshallingPayloadEndpoint`, you can access the `MessageContext` in a couple of ways, depending on your setup. Since you specifically mentioned that you need to access HTTP request parameters within these endpoints, you can do this by using a `Serv... | 33,833 | [
{
"from": "human",
"value": "What is the \"canonical\" way to access the MessageContext from a PayloadEndpoint?\nWe are using PayloadEndpoint and AbstractMarshallingPayloadEndpoint which do not expose the MessageContext to their invoke / invokeinternal methods, but will now need to access the HTTP request p... |
I do TDD on a daily basis for my C++ development on Solaris10. It has greatly reduced the time I have to spend using my debugger but sometime this is the only option.
DBX is pretty powerful but not that user friendly. Note that I'm talking about console DBX not the SunStudio GUI for DBX).
What are the best productivity... | Debugging C++ applications with DBX in a Solaris 10 environment can indeed be a bit challenging, especially when relying solely on the console interface. Here are several productivity tips that can help streamline your debugging process with DBX:
### 1. **Familiarize Yourself with Basic Commands**
- Ensure you know... | 33,037 | [
{
"from": "human",
"value": "I do TDD on a daily basis for my C++ development on Solaris10. It has greatly reduced the time I have to spend using my debugger but sometime this is the only option.\nDBX is pretty powerful but not that user friendly. Note that I'm talking about console DBX not the SunStudio GU... |
I wanted to write a Visual Studio Macro or something similar which can fetch function name and insert into preset location in the error report part. It's clearer if you look at the example
Class SampleClass
{
public void FunctionA()
{
try
{
//Do some work here
}
c... | To create a Visual Studio macro that inserts function names into your logging statements, you will need to leverage the Visual Studio automation model (DTE). Although Visual Studio has deprecated built-in support for macros in favor of extensions, you can still accomplish your goal using a Visual Studio extension or a ... | 30,279 | [
{
"from": "human",
"value": "I wanted to write a Visual Studio Macro or something similar which can fetch function name and insert into preset location in the error report part. It's clearer if you look at the example\nClass SampleClass\n{\n public void FunctionA()\n {\n try\n {\n ... |
Can I run multiple hudson slaves on a single machine, I mean real slaves with only one build process?
My problem is, I have a slave with 3 build processes, using locks-and-latches (V0.4) to run three different kinds of build jobs. But sometimes I have the problem that more than one build job of one kind runs at the sam... | Yes, you can run multiple Hudson (Jenkins) slaves (now typically referred to as "agents") on a single machine. This can help you isolate your build processes and ensure that each one runs independently without interfering with others. Here are some steps and considerations to set this up:
### Setting Up Multiple Jenki... | 35,114 | [
{
"from": "human",
"value": "Can I run multiple hudson slaves on a single machine, I mean real slaves with only one build process?\nMy problem is, I have a slave with 3 build processes, using locks-and-latches (V0.4) to run three different kinds of build jobs. But sometimes I have the problem that more than... |
I'm exploring the iPhone SDK and want to create and use a UI component like the figure below. A rounded table with cells in which each cell can have some label text, maybe an input text field and an action button that would take it to the next screen. The table should not be screen filling.
But... I can't figure out ho... | Creating a custom UI component similar to the one you described can be achieved using a `UITableView` in iOS. You can set up the table view to be a specific size, customize the cells to include labels, text fields, and buttons, and manage navigation to the next screen. Here’s a step-by-step guide to help you build this... | 23,646 | [
{
"from": "human",
"value": "I'm exploring the iPhone SDK and want to create and use a UI component like the figure below. A rounded table with cells in which each cell can have some label text, maybe an input text field and an action button that would take it to the next screen. The table should not be scr... |
I know I can loop over the string or build a regex or invert the set (ASCII isn't that big after all) and search for the first instance of that, but Yuck.
What I'm looking for is a nice one liner.
fewer features is better, LINQ is out (for me, don't ask, it's a long story)
The solution I'm going with (unless I see som... | If you're looking for a more concise way to achieve the same result in C#, you can use LINQ's `Select` and `Where` methods combined with `FirstOrDefault`. Although you mentioned you're not using LINQ, here's a simple one-liner using a `for` loop as you have proposed.
Here’s a streamlined version of your approach that... | 34,541 | [
{
"from": "human",
"value": "I know I can loop over the string or build a regex or invert the set (ASCII isn't that big after all) and search for the first instance of that, but Yuck.\nWhat I'm looking for is a nice one liner.\nfewer features is better, LINQ is out (for me, don't ask, it's a long story)\n\n... |
I'm attempting to modify an Infragisitcs UltraDateTimeEditor control so that the current year and a default time are inserted when the user only enters values for the month and day.
The control has an AutoFillDate property, however setting this to "year" seems to overwrite user input entirely. Also changing the Invalid... | To achieve your goal of automatically filling in the current year and a default time when the user enters values for the month and day in the Infragistics UltraDateTimeEditor, you will need to handle certain events of the control effectively.
Here's a general approach you can follow:
1. **Use the `Validating` Event**... | 29,019 | [
{
"from": "human",
"value": "I'm attempting to modify an Infragisitcs UltraDateTimeEditor control so that the current year and a default time are inserted when the user only enters values for the month and day.\nThe control has an AutoFillDate property, however setting this to \"year\" seems to overwrite us... |
I am working on a project that is going to use CouchDB for flexible storage of documents. The requirements of my system are a neat match for CouchDB for storage.
BUT
My question really boils down to this:
Should I keeop using ActiveRecord and MySQL as well ... there are a raft of handy Plugins that are all readily avai... | Deciding whether to continue using ActiveRecord with MySQL in addition to CouchDB involves weighing the benefits and drawbacks of each option. Here are some considerations to help you make an informed decision:
### Advantages of Using ActiveRecord with MySQL
1. **Mature Ecosystem**: ActiveRecord has a well-establishe... | 30,883 | [
{
"from": "human",
"value": "I am working on a project that is going to use CouchDB for flexible storage of documents. The requirements of my system are a neat match for CouchDB for storage.\nBUT\nMy question really boils down to this:\nShould I keeop using ActiveRecord and MySQL as well ... there are a raf... |
I just found out that by converting PNG32 to PNG8 via Photoshop will fix the PNG transparency bug in IE<=6.
So I had this thought that instead of serving PNG32 to all browser, why not serve PNG8 if the client is using IE<=6.
I'm not really an expert when it comes to htaccess/httpd directives so I'm here for help.
Th... | To serve different image formats based on the browser version using Apache's `.htaccess` file, you can utilize the `BrowserMatch` directive to identify IE browsers and their versions. However, directly serving different files for IE <= 6 and other browsers can be accomplished using the `RewriteEngine`.
Here's how you ... | 33,599 | [
{
"from": "human",
"value": "I just found out that by converting PNG32 to PNG8 via Photoshop will fix the PNG transparency bug in IE<=6. \nSo I had this thought that instead of serving PNG32 to all browser, why not serve PNG8 if the client is using IE<=6. \nI'm not really an expert when it comes to htaccess... |
I'm trying to get my MySQL table to behave as the utf8 table in Example 2 from this MySQL Reference page:
CREATE TABLE germanutf8 (c CHAR(10)) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
INSERT INTO germanutf8 VALUES ('Bar'), ('Bär');
SELECT * FROM germanutf8 WHERE c = 'Bär';
According to the example, this should yiel... | It looks like you're encountering an issue with character set configurations in your MySQL setup. Here are a few steps and considerations to ensure that your MySQL table behaves as expected with UTF-8:
1. **Table and Column Definition**: Ensure your table is properly created with the correct character set and collatio... | 33,088 | [
{
"from": "human",
"value": "I'm trying to get my MySQL table to behave as the utf8 table in Example 2 from this MySQL Reference page:\nCREATE TABLE germanutf8 (c CHAR(10)) CHARACTER SET utf8 COLLATE utf8_unicode_ci;\nINSERT INTO germanutf8 VALUES ('Bar'), ('Bär');\nSELECT * FROM germanutf8 WHERE c = 'Bär';... |
I'm using the Searchgasm plugin for my searching and pagination. Everything seems to work great but the page links don't seem to work at all. Has anyone had this problem with Searchgasm before?
Controller Code:
class ArtistsController < ApplicationController
# GET /artists
# GET /artists.xml
def index
@sear... | It looks like you're experiencing issues with the pagination links generated by the Searchgasm plugin in your Rails application. Here are some potential solutions and troubleshooting steps to ensure the pagination links work correctly:
### 1. Ensure Correct Configuration for Pagination
Make sure you are correctly set... | 32,351 | [
{
"from": "human",
"value": "I'm using the Searchgasm plugin for my searching and pagination. Everything seems to work great but the page links don't seem to work at all. Has anyone had this problem with Searchgasm before?\nController Code:\nclass ArtistsController < ApplicationController\n # GET /artist... |
Just starting to explore the 'wonders' of regex. Being someone who learns from trial and error, I'm really struggling because my trials are throwing up a disproportionate amount of errors... My experiments are in PHP using ereg().
Anyway. I work with first and last names separately but for now using the same regex. ... | It's great that you're diving into regular expressions (regex) to handle name validation in PHP! You've already made good progress with your initial regex. Let's build on that to accommodate the special cases you mentioned.
### Updated Regex
To create a regex that accepts:
- Capitalized first letter
- Letters (both up... | 33,959 | [
{
"from": "human",
"value": "Just starting to explore the 'wonders' of regex. Being someone who learns from trial and error, I'm really struggling because my trials are throwing up a disproportionate amount of errors... My experiments are in PHP using ereg().\nAnyway. I work with first and last names sep... |
One of the "best practice" is accessing data via stored procedures. I understand why is this scenario good.
My motivation is split database and application logic ( the tables can me changed, if the behaviour of stored procedures are same ), defence for SQL injection ( users can not execute "select * from some_tables", ... | Using stored procedures to encapsulate database access is indeed a good practice, as you've outlined, with benefits like improved security, abstraction, and easier maintenance. However, when it comes to dynamic filtering with complex conditions, there are a few common approaches that can strike a balance between flexib... | 29,568 | [
{
"from": "human",
"value": "One of the \"best practice\" is accessing data via stored procedures. I understand why is this scenario good.\nMy motivation is split database and application logic ( the tables can me changed, if the behaviour of stored procedures are same ), defence for SQL injection ( users c... |
I have several static factory patterns in my PHP library. However, memory footprint is getting out of hand and we want to reduce the number of files required during execution time. Here is an example of where we are today:
require_once('Car.php');
require_once('Truck.php');
abstract class Auto
{
// ... some stuff ... | In PHP, using `require_once` ensures that a file is only included once in the execution context, which prevents multiple inclusions of the same file and potential memory leaks due to redeclaration of classes or functions. However, your concern regarding the memory footprint when using multiple files is valid, especiall... | 33,665 | [
{
"from": "human",
"value": "I have several static factory patterns in my PHP library. However, memory footprint is getting out of hand and we want to reduce the number of files required during execution time. Here is an example of where we are today:\nrequire_once('Car.php');\nrequire_once('Truck.php');\n\... |
I need a tool that handle both on-screen and printed reports, via my C# application.
I'm looking for simple, standard and powerful.
I need to be able to give the user the ability to select which columns to display, formatting, etc... with my own GUI and dynamically build the report based upon their choices. Crystal d... | Given your requirements for flexibility, user control over report formatting, and support for both on-screen and printed reports, there are several approaches you can consider:
1. **Custom HTML with WebBrowser Control:**
- If you are comfortable with web technologies (HTML, CSS, JavaScript), this can be a powerful ... | 31,064 | [
{
"from": "human",
"value": "I need a tool that handle both on-screen and printed reports, via my C# application. \nI'm looking for simple, standard and powerful. \nI need to be able to give the user the ability to select which columns to display, formatting, etc... with my own GUI and dynamically build the... |
Consider the following signature in C#:
double Divide(int numerator, int denominator);
Is there a performance difference between the following implementations?
return (double)numerator / denominator;
return numerator / (double)denominator;
return (double)numerator / (double)denominator;
I'm assuming that both of th... | Yes, there is a subtle performance difference among the three implementations you've provided, primarily due to how C# handles the conversion between `int` and `double`.
Let's break down each implementation:
1. **`return (double)numerator / denominator;`**
- Here, `numerator` is cast to `double` before the divisio... | 34,794 | [
{
"from": "human",
"value": "Consider the following signature in C#:\ndouble Divide(int numerator, int denominator);\n\nIs there a performance difference between the following implementations?\nreturn (double)numerator / denominator;\n\nreturn numerator / (double)denominator;\n\nreturn (double)numerator / (... |
I have a pseudo-realtime data processing application where I would like to use LazyInit<double> so I don't do calculations I don't need, but LazyInit<T> restricts T to classes. I can work around it, but I'd obviously prefer not to.
Does anybody know why this is?
| The restriction of `LazyInit<T>` to classes in some programming environments is primarily due to how lazy initialization is designed to work with reference types. In languages like C#, lazy initialization can help improve performance and resource usage by deferring the creation of an object until it is actually needed.... | 34,983 | [
{
"from": "human",
"value": "I have a pseudo-realtime data processing application where I would like to use LazyInit<double> so I don't do calculations I don't need, but LazyInit<T> restricts T to classes. I can work around it, but I'd obviously prefer not to.\nDoes anybody know why this is?\n"
},
{
... |
I have a webservice, which takes java.lang.object objects as parameters (because at runtime only know hte type of object)...after doing process, reply response setting java.lang.Object to it.
I am able to send the reuest objects to webservice from calling program, but getting NotSerializable exception while building th... | In Java, the `java.lang.Object` class does not implement the `Serializable` interface, which is why you're encountering a `NotSerializableException` when trying to serialize an object of type `Object`. This is a common issue when dealing with serialization in Java. Here’s how you can handle this situation:
### Steps t... | 31,522 | [
{
"from": "human",
"value": "I have a webservice, which takes java.lang.object objects as parameters (because at runtime only know hte type of object)...after doing process, reply response setting java.lang.Object to it.\nI am able to send the reuest objects to webservice from calling program, but getting N... |
For a website like reddit with lots of up/down votes and lots of comments per topic what should I go with?
Lighttpd/Php or Lighttpd/CherryPy/Genshi/SQLAlchemy?
and for database what would scale better / be fastest MySQL ( 4.1 or 5 ? ) or PostgreSQL?
| When considering a website like Reddit that requires handling a lot of upvotes/downvotes and comments per topic, both Lighttpd/Php and Lighttpd/CherryPy/Genshi/SQLAlchemy could be viable options, but there are key differences that might influence your decision:
### Lighttpd/PHP vs. Lighttpd/CherryPy/Genshi/SQLAlchemy
... | 33,213 | [
{
"from": "human",
"value": "For a website like reddit with lots of up/down votes and lots of comments per topic what should I go with?\nLighttpd/Php or Lighttpd/CherryPy/Genshi/SQLAlchemy?\nand for database what would scale better / be fastest MySQL ( 4.1 or 5 ? ) or PostgreSQL?\n"
},
{
"from": "gp... |
"C Interfaces and Implementations" shows some interesting usage patterns for data structures, but I am sure there are others out there.
http://www.amazon.com/Interfaces-Implementations-Techniques-Addison-Wesley-Professional/dp/0201498413
| "C Interfaces and Implementations" by David R. Hanson is indeed a valuable resource for exploring various data structure usage patterns in the C programming language. The book emphasizes the importance of designing interfaces for data structures and offers practical implementations, demonstrating how to encapsulate dat... | 34,167 | [
{
"from": "human",
"value": "\"C Interfaces and Implementations\" shows some interesting usage patterns for data structures, but I am sure there are others out there.\nhttp://www.amazon.com/Interfaces-Implementations-Techniques-Addison-Wesley-Professional/dp/0201498413\n"
},
{
"from": "gpt",
"v... |
I see many different Java terms floating around. I need to install the JDK 1.6. It was my understanding that Java 6 == Java 1.6. However, when I install Java SE 6, I get a JVM that reports as version 11.0! Who can solve the madness?
| The confusion arises from the way Java versions are numbered and branded over time. Here’s a quick explanation to clarify:
1. **Java Versioning**:
- Java versions have historically been referred to as Java 1.x, where the "1" represents the major version. For example, Java 1.6 is commonly known as Java 6.
- Hen... | 34,437 | [
{
"from": "human",
"value": "I see many different Java terms floating around. I need to install the JDK 1.6. It was my understanding that Java 6 == Java 1.6. However, when I install Java SE 6, I get a JVM that reports as version 11.0! Who can solve the madness?\n"
},
{
"from": "gpt",
"value"... |
What is a fast way to select a random row from a large mysql table?
I'm working in php, but I'm interested in any solution even if it's in another language.
| Selecting a random row from a large MySQL table can be done in various ways, but some methods are more efficient than others. Here are a few approaches you might consider:
### 1. Using `ORDER BY RAND()`
This is the simplest method, but it is not efficient for large tables since it requires sorting the entire table ra... | 31,087 | [
{
"from": "human",
"value": "What is a fast way to select a random row from a large mysql table?\nI'm working in php, but I'm interested in any solution even if it's in another language.\n"
},
{
"from": "gpt",
"value": "Selecting a random row from a large MySQL table can be done in various ways,... |
Not sure if anyone listened to Hanselminutes episodes 134 and 135, but at the end of show 135 Scott Hanselman had a lot of great advice on how to setup a baseline secure environment for a web application. As a developer, most of my time is focused on developing the application, not on the network facet of the project,... | Setting up a secure environment for a web application, especially as a startup with limited resources, can be a daunting task. However, there are many resources available to help you learn about network security, server configuration, and best practices for protecting your application. Here’s a list of recommended read... | 31,621 | [
{
"from": "human",
"value": "Not sure if anyone listened to Hanselminutes episodes 134 and 135, but at the end of show 135 Scott Hanselman had a lot of great advice on how to setup a baseline secure environment for a web application. As a developer, most of my time is focused on developing the application,... |
I noticed that the ASP.NET cache items are inspected (and possibly removed) every 20 seconds (and oddly enough each time at HH:MM:00, HH:MM:20 and HH:MM:40). I spent about 15 minutes looking how to change this parameter without any success. I also tried to set the following in web.config, but it did not help:
<cache pr... | In ASP.NET, the cache item expiration and item eviction logic is built into the framework and does not provide direct configuration options to change the cache polling intervals such as the 20-second check you are observing. However, I can help you understand how you can manage caching behavior to better suit your appl... | 34,304 | [
{
"from": "human",
"value": "I noticed that the ASP.NET cache items are inspected (and possibly removed) every 20 seconds (and oddly enough each time at HH:MM:00, HH:MM:20 and HH:MM:40). I spent about 15 minutes looking how to change this parameter without any success. I also tried to set the following in w... |
For a random event generator I'm writing I need a simple algorithm to generate random ranges.
So, for example:
I may say I want 10 random intervals, between 1/1 and 1/7, with no overlap, in the states (1,2,3) where state 1 events add up to 1 day, state 2 events add up to 2 days and state 3 events add up to the rest.
... | To generate random non-overlapping intervals based on the provided constraints, we can implement the `GetRandomIntervals` method in a straightforward manner. The approach involves the following steps:
1. **Calculate Available Time Slots**: First, we'll calculate the total available time between the `start` and `end` d... | 28,108 | [
{
"from": "human",
"value": "For a random event generator I'm writing I need a simple algorithm to generate random ranges. \nSo, for example:\nI may say I want 10 random intervals, between 1/1 and 1/7, with no overlap, in the states (1,2,3) where state 1 events add up to 1 day, state 2 events add up to 2 da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.