instruction stringlengths 0 30k ⌀ |
|---|
We're using [IdeaBlade][1] on our projects. I've found it to be pretty easy to use.
[1]: http://www.ideablade.com/ |
Load Balancing of Process in 1 Server |
|linux|load-balancing| |
I have 1 process that receives incoming connection from port 1000 in 1 **linux** server. However, 1 process is not fast enough to handle all the incoming request.
I want to run multiple processes in the server but with 1 end-point. In this way, the client will only see 1 end-point/process not multiple.
I have che... |
Adding Functionality to Rails |
|ruby|ruby-on-rails| |
I'm working on a Rails app and am looking to include some functionality from an [earlier question][1] I asked here. However, I'm having problems getting it to work. I was under the impression that I should just make a file in the lib directory, so I named it 'get_ip.rb', with the contents:
require 'socket'
... |
updating an auto_now DateTimeField in a parent model w/ Django |
|database|orm|django| |
I've got two models: Message and Attachment. Each attachment is attached to a specific message, using a ForeignKey on the Attachment model. Both models have an auto_now DateTimeField called updated. I'm trying to make it so that when any attachment is saved, it also sets the updated field on the associated message to n... |
|python|database|django|orm| |
[@Mark Biek][1]
I was going to say that, but you beat me to it! Anyways, I just wanted to add that there is also the -R option:
ssh -R 8022:myinsideserver:22 paul@myoutsideserver
The difference is what machine you are connecting to/from. My boss showed me this trick not too long ago, and it is definitely... |
When merging two code branches in TFS, I get an error stating: "the given key was not present in the dictionary". Some files are checked out and show up in "Pending Changes", but no changes are actually made.
I have a workaround:
1. Attempt to merge (Fails with error)
2. Get latest from trunk
3. Undo ... |
|tfs|merge| |
Error using Team Foundation Server merge function |
When merging two code branches in Team Foundation Server I get the following error:
"the given key was not present in the dictionary"
Some files are checked out and show up in "Pending Changes", but no changes are actually made.
I have a workaround:
1. Attempt to merge (fails with error)
2. Get la... |
When merging two code branches in Team Foundation Server I get the following error:
"the given key was not present in the dictionary"
Some files are checked out and show up in "Pending Changes", but no changes are actually made.
I have a workaround:
1. Attempt to merge (fails with error)
2. Get la... |
Using Regular Expressions is probably the best way. Here's an example:
function validateEmail(email)
{
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\
".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA
-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return email... |
Can't you just start with a hash code, and if the hash codes match, do a character by character comparison? |
What is the best approach for disabling a submit button? |
|webforms|asp.net|javascript| |
Details:
* Only disable after user clicks the submit button
* ASP.NET Webforms (.NET 1.1)
* Prefer jQuery (if any library at all)
* Must be enabled if form reloads (i.e. credit card failed)
This isn't a necessity that I do this, but if there is a simple way to do it without having to change too much, I'll do i... |
What is the best approach for (client-side) disabling of a submit button? |
Details:
* Only disable after user clicks the submit button, but before the posting back to the server
* ASP.NET Webforms (.NET 1.1)
* Prefer jQuery (if any library at all)
* Must be enabled if form reloads (i.e. credit card failed)
This isn't a necessity that I do this, but if there is a simple way to do it w... |
You might want to experiment with a not-strictly-database solution like a [Java Content Repository][1] implementation (e.g. [Apache Jackrabbit][2]) and use a search engine built on top of that like [Apache Lucene][3].
This solution with the appropriate caching mechanisms would possibly yield better performance than ... |
You won't be able to avoid joins and still be somewhat normalized.
My approach is to have a Tag Table.
TagId (PK)| TagName (Indexed)
Then, you have a TagXREFID column in your items table.
This TagXREFID column is a FK to a 3rd table, I'll call it TagXREF:
TagXrefID | ItemID | TagId
So, to ge... |
You won't be able to avoid joins and still be somewhat normalized.
My approach is to have a Tag Table.
TagId (PK)| TagName (Indexed)
Then, you have a TagXREFID column in your items table.
This TagXREFID column is a FK to a 3rd table, I'll call it TagXREF:
TagXrefID | ItemID | TagId
So, to ge... |
You won't be able to avoid joins and still be somewhat normalized.
My approach is to have a Tag Table.
TagId (PK)| TagName (Indexed)
Then, you have a TagXREFID column in your items table.
This TagXREFID column is a FK to a 3rd table, I'll call it TagXREF:
TagXrefID | ItemID | TagId
So, to ge... |
You might want to look at Oracle XE. I cannot remember all of the differences, but O-Lite didn't fit my project needs. Oracle XE is a very good database for local development.
Brad |
I have recently integrated the [Compass][1] search engine into a Java EE 5 application. It is based on [Lucene Java][2] and supports different ORM frameworks as well as other types of models like XML or no real model at all ;)
In the case of an object model managed by an ORM framework you can annotate your classes w... |
+1 for PuTTy... been using it for the last decade and never needed anything else! |
If you are using Delphi, I highly recommend [Indy][1] sockets, a set of classes for easy manipulation of sockets and many other internet protocols (HTTP, FTP, NTP, POP3 etc.)
[1]: http://www.indyproject.org/index.en.aspx |
I use:
- Infragistics (.NET WinForms controls)
- LeadTools (video capture)
- Xtreme ToolkitPro (MFC controls)
- National Instruments Measurement Studio (computational libraries, plotting, and DAQ)
I've found significant bugs in every one of these, so I try to limit their use as much as possible. Infra... |
I just use simple questions that anyone can answer:
What color is the sky?
What color is an orange?
What color is grass?
It makes it so that someone has to custom program a bot to your site, which probably isn't worth the effort. If they do, you just change the questions. |
Pulling loads of binary data out of your DB over the wire is going to cause huge latency issues and won't scale well.
Store paths in the DB and let your webserver take the load - it's what it was designed for! |
By far the most painful part of moving an application from XP to Vista (from my point of view) is dealing with the numerous services and IPv6 stuff that uses ports which were previously free, and dealing with the Wireless Provisioning -> Native WiFi transition.
The UAC stuff is basically a moot point; there is very ... |
[IO::Dir][1] is nice and provides a tied hash interface as well.
From the perldoc:
use IO::Dir;
$d = IO::Dir->new(".");
if (defined $d) {
while (defined($_ = $d->read)) { something($_); }
$d->rewind;
while (defined($_ = $d->read)) { something_else($_); }
undef $d;... |
Interestingly, if you click on the screen (remove the focus from the textbox) on second example with only one textbox, the event onClick fires... So it's not an expected behaviour since it only occurs when you have just one textbox _and_ you have the focus on the textbox.
I'm afraid you've found a bug on the browser... |
First you need to setup where Ant can find the Emma libraries:
<path id="emma.lib" >
<pathelement location="${emma.dir}/emma.jar" />
<pathelement location="${emma.dir}/emma_ant.jar" />
</path>
Then import the task:
<taskdef resource="emma_ant.properties" classpathref="emma.lib" /... |
According to the [XML-RPC Spec][1] it returns the "fault" in the xml.
Is this the "Exception" you are referring to or are you refering to a Java Exception generated while making the XML-RPC call?
**Fault example**
HTTP/1.1 200 OK
Connection: close
Content-Length: 426
Content-Type: text/xml... |
I've been using Assembly.CodeBase instead of Location:
Assembly a;
a = Assembly.GetAssembly(typeof(DaoTests));
string s = a.CodeBase.ToUpper(); // file:///c:/path/name.dll
Assert.AreEqual(true, s.StartsWith("FILE://"), "CodeBase is " + s);
s = s.Substring(7, s.LastIndexOf('/') - 7); // 7 = "f... |
I want to show a chromeless modal window with a close button in the upper right corner.
Is this possible? |
[This other question][1] also has some useful links in it...
[1]: http://stackoverflow.com/questions/22278/whats-a-good-way-to-encapsulate-data-access-with-phpmysql |
How about:
select top 3 with ties points
from scores
order by scores desc
Not sure if "with ties" works on anything other the SQL Server. |
How about:
select top 3 with ties points
from scores
order by scores desc
Not sure if "with ties" works on anything other the SQL Server.
On SQL Server 2005 and up, you can pass the "top" number as an int parameter:
select top (@n) with ties points
from scores
order by scores d... |
How about:
select top 3 with ties points
from scores
order by points desc
Not sure if "with ties" works on anything other the SQL Server.
On SQL Server 2005 and up, you can pass the "top" number as an int parameter:
select top (@n) with ties points
from scores
order by points d... |
<http://beta.stackoverflow.com/questions/25259/how-do-you-change-a-title-to-be-part-of-the-url-like-stackoverflow> |
Here's how we do it. Note that there are probably more edge conditions than you realize at first glance..
if (String.IsNullOrEmpty(title)) return "";
// remove entities
title = Regex.Replace(title, @"&\w+;", "");
// remove anything that is not letters, numbers, dash, or space
title = Re... |
Have a look at the [Calais Viewer](http://sws.clearforest.com/calaisviewer/) for a real world application. |
The filesystem's prety handy for storing binary data, which never works amazingly well in relational databases. |
You should separate logic and presentation. Using MVP(Model-View-Presenter)/MVC (Model-View-Controller) patterns you can unit test you logic without relying on UI events.
Also you can use [White framework][1] to simulate user input.
I would highly recommend you to visit Microsoft's [Patterns&Practices developer cente... |
how to teach a crash course on C++ |
|c++|teaching| |
In a few weeks we'll be teaching a crash course on C++ for Java programmers straight out of college. They have little or no experience yet with C or C++.
Previous editions of this course were just 1 or 2 half-day sessions and covered topics including:
* new language features, e.g.
* header vs. implementation
... |
problem with dojo dijit.form.ValidationTextBox |
|javascript|dojo| |
The following xhtml code is not working:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="... |
Don't know much about this field, but maybe an [Astaro security gateway][1]?
[1]: http://www.astaro.com/ |
I'm still foggy as to why you can't store whatever object(s) you are binding against in session. If you could store that object in session the following should work:
1. On first Page_Load bind top user control to the object. Store the object in session. Viewstate will automatically be stored for those controls.
2. ... |
I think one of the most under-appreciated and lesser-known features of C# (3.5) are Expression Trees, **especially** when combined with Generics and Lambdas. This is an approach to API creation that newer libraries like NInject and Moq are using.
For example, let's say that I want to register a method with an API an... |
You might have an open transaction on the dev db...that gets me sometimes on SQL Server |
Using generic classes with ObjectDataSource |
|asp.net|generics|objectdatasource| |
I have a generic Repository<T> class I want to use with an ObjectDataSource. Repository<T> lives in a separate project called DataAccess. According to <a href="http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/767f1a821d9b23da/b1e045958ae427a5?lnk=st#b1e045958ae427... |
I have a generic Repository<T> class I want to use with an ObjectDataSource. Repository<T> lives in a separate project called DataAccess. According to <a href="http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/767f1a821d9b23da/b1e045958ae427a5?lnk=st#b1e045958ae427... |
MS SQL Stored Procedures. |
I usually create a DataTier with LiNQ.
It consist of repositories that implement composite interfaces, so I have total flexibility on how to use them.
IPersonRepository : IReadRepository<Person>, ICreateRepository<Person>, IUpdateRepository<Person> //and so on..
They are mostly domain object centric, so ... |
For UI, check out [Ext][1].
It's great as a standalone library, though it can also be used with jQuery, YUI, Prototype and GWT.
Samples: [http://extjs.com/deploy/dev/examples/samples.html][2]
[1]: http://extjs.com/
[2]: http://extjs.com/deploy/dev/examples/samples.html |
* SQL Server
* All stored procedures
* Handrolled polymorphic entity framework that I reuse from project to project to handle the Sproc Resultset -> Object mapping.
I guess that makes me oldschool. |
Another way to go would be to use ssh tunneling (which happens on the client side).
You'd do an ssh command like this:
ssh -L 8022:myinsideserver:22 paul@myoutsideserver
That connects you to the machine that's accessible from the outside (myoutsideserver) and creates a tunnel through that ssh connection to... |
Another way to go would be to use ssh tunneling (which happens on the client side).
You'd do an ssh command like this:
ssh -L 8022:myinsideserver:22 paul@myoutsideserver
That connects you to the machine that's accessible from the outside (myoutsideserver) and creates a tunnel through that ssh connection to... |
|asp.net|javascript|.net-1.1|webforms| |
|asp.net|javascript|jquery|webforms|.net-1.1| |
How big are your strings? Arbitrarily long strings cannot be compressed into 32/64 bit format. |
Some notable problems I saw when attempting to convert a large number of AS2 classes to AS3:
### Package naming
class your.package.YourClass
{
}
becomes
package your.package
{
class YourClass
{
}
}
### Imports are required
You must explicitly impo... |
Yes -- you can also use a newer version of Visual Studio. As long as you have the PDB file for the target application it doesn't matter what version it was built with (well, VS6 might not understand a newer PDB, but backwards should be fine).
The remote debugging experience on newer VS versions is a lot smoother th... |
If all you want to do is remove the changes made in revision 3, you might want to use git revert.
Git revert simply creates a new revision with changes that undo all of the changes in the revision you are reverting.
What this means, is that you retain information about both the unwanted commit, and the commit tha... |
You shouldn't need to import any win32 functions for this. If .Focus() isn't enough the form should also have a .BringToFront() method you can use. If that fails, you can set it's .TopMost property to true. You don't want to _leave_ it true forever, so then call Application.DoEvents so the form can process that mess... |
If you don't want collisions, try something insane like SHA-512. I can't guarantee there won't be collisions, but I don't think they have found any yet. |
I'm still foggy as to why you can't store whatever object(s) you are binding against in session. If you could store that object in session the following should work:
1. On first load bind your top user control to the object during On_Init. Store the object in session. Viewstate will automatically be stored for those... |
I'm still foggy as to why you can't store whatever object(s) you are binding against in session. If you could store that object in session the following should work:
1. On first load bind your top user control to the object during On_Init. Store the object in session. Viewstate will automatically be stored for those... |
> I have to explicitly null the session
> value during non postbacks in order to
> emulate how ViewState works.
I'm still foggy as to why you can't store whatever object(s) you are binding against in session. If you could store that object in session the following should work:
1. On first load bind your top use... |
There is also [DP_DateExtensions][1], though I believe DateJS is more robust.
[1]: http://www.depressedpress.com/Content/Development/JavaScript/Extensions/DP_DateExtensions/Index.cfm |
From what it says on the PHP website, you can use crypt() in the following method:
<?php
// Set the password & username
$username = 'user';
$password = 'mypassword';
// Get the hash, letting the salt be automatically generated
$hash = crypt($password);
// write to ... |
It can be done in CSS! Don't let people tell you otherwise.
The easiest, most pain-free way to do it is to use the [Faux Columns](http://www.alistapart.com/articles/fauxcolumns/) method.
However, if that solution doesn't work for you, you'll want to read up on [this technique](http://www.positioniseverything.net/... |
Yes, ++ to Matt and System.AddIn (a two-part MSDN magazine article about System.AddIn are available [here](http://msdn.microsoft.com/en-us/magazine/cc163476.aspx) and [here](http://msdn.microsoft.com/en-us/magazine/cc163460.aspx)). Another technology you might want to look at to get an idea where the .NET Framework mig... |
Algorithm to decide if digital audio data is clipping? |
|algorithm|audio|heuristics| |
Is there an algorithm or some heuristic to decide whether digital audio data is [clipping][1]?
[1]: http://en.wikipedia.org/wiki/Clipping_(audio)#Digital_clipping |
Thanks to the answers I received I was able to create something like the following, which suits my needs. My question was somewhat ambiguous..thanks for following up...my final problem was solved by including "selected" in the option that I wanted selected.
HTML
<label>One<input name="myRadio" type="radio" v... |
You haven't described how you're trying to use the method, so I apologize in advance if this is stuff you already know.
The methods on a module never come into use unless the module is included into a class. Instance methods on a class require there to be an instance of the class. You probably want a class method ... |
Django Calendar Widget? |
|django|calendar| |
Does anyone know of any existing packages or libraries that can be used to build a calendar in a django app? |
How do I make AutoCompleteExtender render above select controls in IE6 |
|asp.net|internet-explorer-6|autocompleteextender| |
When an AutoCompleteExtender is displayed in IE6 it seems to ignore z-index and renders below any select controls (like dropdownlists) in IE6.
<asp:TextBox ID="TextBox1" runat="server" />
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="TextBox1" EnableCaching=... |
A quick google search reveals [django-calendar](http://code.google.com/p/django-calendar/), which looks like exactly what you need. It would also be worth looking at the snippets under the calendar tag on Django Snippets at <http://www.djangosnippets.org/tags/calendar/>. |
The question is a little unclear to me, but I suspect the answer you are looking for is to have a single process accepting tasks from the network, and then forking off 'worker processes' to actually perform the work (before returning the result to the user).
In that way, the work which is being done does not block t... |
Java, Signed JARs and JAAS.
Java to prevent buffer overflow and pointer/stack whacking exploits.
Don't use JNI. ( Java Native Interface) it exposes you to DLL/Shared libraries.
Signed JAR's to stop class loading being a security problem.
JAAS can let your application not trust anyone, even itself.
J2EE ... |