instruction stringlengths 0 30k ⌀ |
|---|
|jdb| |
anyone have any experience using this?
if so, is it worth while? |
|java|jdb| |
What's going to be fastest depends on what percentage of your list is duplicates. If it's nearly all duplicates, with few unique items, creating a new list will probably be faster. If it's mostly unique items, removing them from the original list (or a copy) will be faster.
Here's one for modifying the list in place... |
You're correct that making target A depend upon target B (whether within the same project or across projects) does **not** cause target A to link against target B. You need to specify them distinctly; this is because they're separate concepts, and you might have dependencies between targets that you _don't_ want to li... |
I've done very little of this sort of performance checking (I tend to just think "this is slow, make it faster") so I have pretty much always gone with this.
A google does reveal a lot of resources/articles for performance checking.
Many mention using pinvoke to get performance information. A lot of the materials... |
> I used to do exactly the same thing.... then I switched to maven.
Oh, it's Maven 2. I was afraid that someone was still seriously using Maven nowadays. Leaving the jokes aside: if you decide to switch to Maven 2, you have to take care while looking for information, because Maven 2 is a complete reimplementation of... |
The problem with learning C within Visual Studio is that you are using a subset of C from the C++ library. You might want to try learning C using the GNU [GCC][1] compiler from within the [Cygwin][2] environment in Windows.
[1]: http://gcc.gnu.org/
[2]: http://www.cygwin.com/ |
The problem with learning C within Visual Studio is that you are compiling C using the Visual Studio C++ compiler. You might want to try learning C using the GNU [GCC][1] compiler from within the [Cygwin][2] environment in Windows.
[1]: http://gcc.gnu.org/
[2]: http://www.cygwin.com/ |
@Tim, I ended up using a simplified version of your approach and ChanChans, Here is the code:
public class TaskFactory
{
private Dictionary<String, Type> _taskTypes = new Dictionary<String, Type>();
public TaskFactory()
{
// Preload the Task ... |
|lucene|database|integration| |
I am looking into mechanisms for better search capabilities against our database. It is currently a huge bottleneck (causing long-lasting queries that are hurting our database performance).
My boss wanted me to look into Solr, but on closer inspection, it seems we actually want some kind of DB integration mechanism... |
How to best search against a DB with Lucene? |
|database|lucene|integration| |
I am looking into mechanisms for better search capabilities against our database. It is currently a huge bottleneck (causing long-lasting queries that are hurting our database performance).
My boss wanted me to look into [Solr][1], but on closer inspection, it seems we actually want some kind of DB integration mech... |
I think you're spot on. If you don't plan on moving this to another transport mechanism I cant see why you would need both message- and transport encryption. If performance is a key factor skipping message encryption will save you some performance since you don't have to add protection on sending/receiving each message... |
If you plan on exposing your entities to the world, you're better off (generally) keeping behavior off of the entity. If you want to centralize your business operations (i.e. ValidateVendorOrder) you wouldn't want the Order to have an IsValid() method that runs some logic to validate itself. You don't want that code ... |
There's a good tutorial on tweaking your network settings (in Linux) to achieve true gigabit speed here: http://datatag.web.cern.ch/datatag/howto/tcp.html |
What type of network connection are you using? If you're using a 1000BaseTx/Fx link, don't expect more than 80% throughput with maximum sized packets. As your packet size decreases, the overhead for spacing, synchronization, Ethernet headers, IP headers and UDP headers increases in relation to the payload and therefo... |
If you use a tool to generate scripts that explicitly names columns (such as SSIS), it should work, as long as there aren't columns in your production database that don't exist in dev. |
String^ speed; String^ size;
Match m;
Regex theregex = new Regex (
"(SPEED=(?<speed>(.*?)))*(SIZE=(?<size>(.*?)))* ",
RegexOptions::ExplicitCapture);
m = theregex.Match (yourinputstring);
if (m.Success)
{
if (m.Groups["speed"].Success)
speed = m.Groups["speed"]... |
String^ speed; String^ size;
Match m;
Regex theregex = new Regex (
"SPEED=(?<speed>(.*?)) SIZE=(?<size>(.*?)) ",
RegexOptions::ExplicitCapture);
m = theregex.Match (yourinputstring);
if (m.Success)
{
if (m.Groups["speed"].Success)
speed = m.Groups["speed"].Valu... |
Yes, all types are always aligned to at least their alignment requirements.
How could it be otherwise?
But note that the sizeof() a type is not the same as it's alignment.
You can use the following macro to determine the alignment requirements of a type:
#define ALIGNMENT_OF( t ) offsetof( struct { char... |
Depends on the compiler, the pragmas and the optimisation level. With modern compilers you can also choose time or space optimisation, which could change the alignment of types as well. |
Depending on the encoding of somefile.txt, a character may not actually be composed of two bytes. <a href="http://java.sun.com/docs/books/tutorial/i18n/text/stream.html">This page</a> gives more information about how to read streams with the proper encoding.
The bummer is, the file system doesn't tell you the encodi... |
I have used CodeSmith and MyGeneration, wasn't overly keen on either, felt somewhat terse to use, learning template languages etc.
SubSonic is what we sometimes use here to generate a Data Access Layer. Used in the right size projects, it is a fantastic time saving tool. [clicky][1]
[1]: http://subsonicprojec... |
It also could depend on the version of Perl. Which you haven't mentioned. And the difference is not enough to worry about anyway. So use whatever makes more sense. |
I've primarily used [LLBLGen Pro][1] to generate code. It offers a variety of patterns to use for generation and you can supply your own patters, just like CodeSmith. The customer support has been excellent.
Essentially, I generate my business objects and DAL using LLBLGen and keep them up to date. The code templ... |
CakePHP View including other views |
|php|templates|cakephp| |
I have a CakePHP application that in some moment will show a view with product media (pictures or videos) I want to know if, there is someway to include another view that threats the video or threats the pictures, depending on a flag. I want to use those "small views" to several other purposes, so It should be "like" a... |
here's one way - using the dateadd function.
-- Setup test
create table #odays (offd datetime)
create table #leadtime (pid int , ltime int)
create table [#order] (pid int, odate datetime)
insert into #odays
select '1/10/8'
insert into #odays
select '1/11/8'
insert... |
Override the GetHashCode method in classes that get called this method and calculate the hash code based on unique object properties (like ID or all object fields). |
Good advice is to look how other projects have done it. Many call for having plugins installed and their "name" registered for services (like wordpress does) so you have "points" in your code where you call a function that identifies registered listeners and executes them. A standard OO design patter is the [Observer P... |
Is the syntax for the Wordpress style.css template element available anywhere? |
|wordpress|wordpress-theming|css| |
I've recently embarked upon the _grand voyage_ of Wordpress theming and I've been reading through the Wordpress documentation for how to write a theme. One thing I came across [here](http://codex.wordpress.org/Theme_Development) was that the `style.css` file must contain a specific header in order to be used by the Wo... |
Also make sure your web.config is setup properly for asp.net ajax:
<http://www.asp.net/AJAX/Documentation/Live/ConfiguringASPNETAJAX.aspx> |
FYI, here's a full sample toy solution that avoids side effects:
outerfunc <- function(names) {
templist <- list()
for (aname in names) {
templist[[aname]] <- innerfunc(aname)
}
templist
}
innerfunc <- function(aname) {
retval <- NULL
if ("one" %... |
I've solved this in the past by adding an instance of a logging class to the base class(es) (or interface, if the language supports that) for the classes that need to access logging. When you log something, the logger looks at the current call stack and determines the invoking code from that, setting the proper metada... |
By default, .Net will not allow you to connect a packet analyzer like TCPTrace or Fiddler (which I prefer) to localhost or 127.0.0.1 connections (for reasons that I forget now..)
Best way would be to reference your web services via a full IP address or FQDN where possible. That will allow you to trace the calls in ... |
As already said, you should check out the VS.net C++ edition, but if you'd like to try something else Eclipse has a C++ edition. You can get more info from http://eclipse.org or check out the distro at http://www.easyeclipse.org/site/distributions/cplusplus.html |
Interfaces are close enough to types that it should feel about the same. I'd use the [as operator][1].
foreach (Control c in this.Page.Controls) {
IMyButtonInterface myButton = c as IMyButtonInterface;
if (myButton != null) {
// do something
}
}
You can also test ... |
I don't know about MySQL, but in MS SQL, you can use the column index in the <code>order by</code> clause. I've done this before when doing counts with <code>group by</code>s as it tends to be easier to work with.
So
<pre>
SELECT COUNT(id), `Tag` from `images-tags`
GROUP BY `Tag`
ORDER BY COUNT(id) DESC
LIMIT ... |
I don't know about MySQL, but in MS SQL, you can use the column index in the <code>order by</code> clause. I've done this before when doing counts with <code>group by</code>s as it tends to be easier to work with.
So
SELECT COUNT(id), `Tag` from `images-tags`
GROUP BY `Tag`
ORDER BY COUNT(id) DESC
... |
You can just search on the Interface. This also uses recursion if the control has child controls, i.e. the button is in a panel.
private List<Control> FindControlsByType(ControlCollection controls, Type typeToFind)
{
List<Control> foundList = new List<Control>();
... |
A somewhat manual process would be to use the [Poster][1] add-in for Firefox. There is also a java utility called [SoapUI][2] that has some discovery based automated templates that you can then modify and run against your service.
[1]: http://code.google.com/p/poster-extension/
[2]: http://sourceforge.net/pr... |
So what you'd have done with all those Pythons and Rubys in the browser?!
1). Still writing scripted client-side apps? Well, this is nicely done with JavaScript.
2). Writing client-server apps using sockets? Why don't write them just without browser?
3). Writing standalone apps? Just do it as you do now. |
Using help from AJ's [answer][1], BelowNinety's [answer][2] and Nerdfest's [answer][3], I came up with the following:
Select Sum(
Case When End = '12/31/9999 12:00:00 AM' Then
DateDiff(mi, Start, Getdate())
Else
DateDiff(mi, Start, End)
End) As ElapsedTim... |
Write a challenging program **from scratch**. Try to get some people (around five, that should be doable) to use it. Respond to their change requests.
Adapt your program's design. Start small, then watch it grow. Manage this growth. **This is hard.** You will also have to fix bugs and maintain the thing over time, w... |
I use Singletons as an interview test.
When I ask a developer to name some design patterns, if all they can name is Singleton, they're not hired. |
How to avoid thousands of needless ListView.SelectedIndexChanged events? |
|listview|selectedindexchanged| |
If a user select all items in a .NET 2.0 ListView, the ListView will fire a SelectedIndexChanged event for every item; rather than firing an event to indicate that the selection has changed
If the user then clicks to select just one item in the list, the ListView will fire a SelectedIndexChagned event for every item... |
|.net|listview|selectedindexchanged| |
Why would a "java.net.ConnectException: Connection timed out" exception occur when URL is up? |
|java|connection|urlconnection|timed| |
I'm getting a ConnectException: Connection timed out with some frequency from my code. The URL I am trying to hit is up. The same code works for some users, but not others. It seems like once one user starts to get this exception they continue to get the exception.
Here is the stack trace:
java.net.Connect... |
@Kyle,
Black-Box reuse means that you use component without knowing it's internals. All you have is a component interface.
White-box reuse means that you know how component is implemented. Usually White-box reuse means class inheritance. |
I've used asp.net winforms with ajax.net as well as prototype/ext/jquery. I guess something to consider is the goal of the site.. MVC is a popular pattern. I can't say anything against ASP MVC because I haven't had a chance to use it, but I want to make sure you know you are not limited to just ajax.net if you chose ... |
Extracting text from PDF is a hard problem because PDF has such a layout-oriented structure. You can see the [docs and source code][1] of my barely-successful attempt on CPAN (my implementation is in Perl). The PDF data structure is very cool and well designed, but it's easier to write than read.
[1]: http://s... |
Adobe Flex Builder is Adobe's IDE for developing applications that will run in the Flash plugin. The Flex SDK refers to the libraries that developers uses to write the applications.
Essentially, the term 'Flex' is the development side and 'Flash' is the run time side of Adobe's technology. |
Adobe Flex Builder is Adobe's IDE for developing applications that will run in the Flash plugin. The Flex SDK refers to the libraries that developers uses to write the applications.
Essentially, the term 'Flex' is the development side and 'Flash' is the run time side of Adobe's technology.
**Correction:** The t... |
Both Nagios and Munin seem to have plugins/support for Xen data collection.
[A Xen Virtual Machine Monitor Plugin for Nagios][1]
[munin plugins][2]
[1]: http://www.novell.com/coolsolutions/feature/19490.html
[2]: http://munin.projects.linpro.no/wiki/PluginCat#Xen
|
Slightly off-topic: try to avoid using lorem ipsum for layout testing!
The letter frequencies in Latin are way different than in e.g. English or German. There's lots of 'i' and 'l', i.e. lots of narrow letters. |
The point of information hiding is to limit exposure to consumers of your object to changes that occur in how your object operates internally. The more likely a piece is to change, the more important it is to keep it away from the interface. This is why getters and setters are common ... the value that is emitted by th... |
Use something like OmBelt's exportSQLServer to SQL tool.
(ombelt.com)
The inserts it makes specify fields so you should be okay. If not, mass-edit them.
I find it greatly simplifies SQLServer to have SQL dumps like other databases. |
here's one way - using the dateadd function.
-- Setup test
create table #odays (offd datetime)
create table #leadtime (pid int , ltime int)
create table [#order] (pid int, odate datetime)
insert into #odays
select '1/10/8'
insert into #odays
select '1/11/8'
insert... |
here's one way - using the dateadd function.
I need to take this answer off the table. This isn't going to work properly for long lead times. It was simply adding the # of off days found in the lead time and pushing the date out. This will cause a problem when more off days show up in the new range.
-- Setu... |
Here is a good procedure for resetting any sequence to 0 from Oracle guru <a href="http://asktom.oracle.com">Tom Kyte</a>. Great discussion on the pros and cons in the links below too.
tkyte@TKYTE901.US.ORACLE.COM>
create or replace
procedure reset_seq( p_seq_name in varchar2 )
is
l_val... |
You can get it to display [time][1]. From that you will probably have to have two controls (one date, one time) the accomplish what you want.
[1]: http://msdn.microsoft.com/en-us/library/ms229631.aspx |
The best method I've used for debugging JavaScript in Internet Explorer is through the **Microsoft Script Editor**. The debugger is full featured and very easy to use.
The article bellow teaches how to install the **Microsoft Script Editor** and configure it.
[HOW-TO: Debug JavaScript in Internet Explorer][1]
... |
Safari, Opera and Firefox all support SVG natively (eg. without plugins) to varying degrees of completeness and correctness, including the ability to script the svg from javascript.
There's also the canvas element which is now being standardised in html5, and is already supported in the above browsers as well (with ... |
Safari, Opera and Firefox all support SVG natively (eg. without plugins) to varying degrees of completeness and correctness, including the ability to script the svg from javascript.
There's also the canvas element which is now being standardised in html5, and is already supported in the above browsers as well (with ... |
Validating a Win32 Window Handle |
|c++|windows|winapi| |
Given a handle of type HWND is it possible to confirm that the handle represents a real window? |
Take a look at the [Raphael Javascript library][1]. It's early days but it looks very promising.
I remember the IE roadmap that had SVG support listed in IE7.2.
Depends on how interactive you want it?
[1]: http://raphaeljs.com/ |
There is a function IsWindow which does exactly what you asked for.
BOOL isRealHandle = IsWindow(unknwodnHandle);
Look at [this link][1] for more information.
[1]: http://msdn.microsoft.com/en-us/library/ms633528(VS.85).aspx |
Generally no. By the time you've got confirmation that a Window is valid another process/thread my come along and remove it for you.
|
From what I can see, Yahoo! is [eating their own dogfood][1] by building Pipes in YUI with the addition of the ultra-cool [CANVAS][2] tag and [IE script file][3] (which I didn't know existed until I did a little digging today) that drive the Visio-like wiring. If you haven't used YUI before you're going to need to do a... |
You could also make the value of the combo box into an uneditable text field and then launch a pop-up/modal window to edit that value. However, if I was doing that, I might be inclined to edit the whole record in one of those windows. |
[InfoQ][1]'s conferences seem to be valuable. Some parts of their materials is available online.
[1]: http://infoq.com/ |
I'm not sure what your main question is here, but yes, .contains is case sensitive. |
[This][1] is a new technique that has popped up in the last month or so. From the page:
> In this script image tags are supported, both with and without a blank spacer GIF, and background image PNGs may be positioned, as well as repeated, even if they're smaller than the content element they're in.
[1]: ... |
Sounds like the sync command has a bug in relation to dir entries and the command. My suggestion would be to just roll the command yourself, using the perforce command line as that has to be set up anyway in order to use the java library.
Process p = Runtime.getRuntime().exec("p4 dirs " + directory_argument);
... |
You are probably thinking about this:
/*
THEME NAME: Parallax
THEME URI: http://parallaxdenigrate.net
VERSION: .1
AUTHOR: Martin Jacobsen
AUTHOR URI: http://martinjacobsen.no
*/
If I'm not way off, Wordpress uses this info to display in the "Activate Design" dialog in the admin backend. |
Have a look at [DevTracer][1]. It also allows monitoring a .NET application remotely.
DISCLAIMER: I am the developer of DevTracer and therfore my opinion may not be neutral.
[1]: http://www.devtracer.com |
As others have already mentioned, when passing objects as parameters to an RMI method, the object will get serialized, then deserialized on the other end inside the target object containing the RMI method. This breaks the reference from the original objects passed in, as you now have two distinct objects: one in the c... |
is it not better to lock an object variable rather than the whole instance?
|
How to determine WPF SelectedItem for a window |
|wpf|selecteditem| |
I have a WPF app with many list based controls in a window, which all are bound to different CollectionViews.
At the window level is there a way to get the current selected item for the currently in focus list based control? I know I can do this with some fairly trivial code by looking for the in focus element but ... |
I'm not convinced that .NET's locking is applicable to different processes. Moreover, lock(this) will only exclude other threads that are running the method on the same instance of "this" - so other threads even in the same process could run at once on different instances.
Assuming all your processes are running on ... |
The dbml files give partial classes, so you can create a new .cs file, define the partial class that you want to extend, and then decorate that with the attributes that you want. For instance if you have a generated data context that looks like
public partial class MyDataContext : System.Data.Linq.DataContext
{
..... |
I'm afraid the DateTimePicker control doesn't have the ability to do those things. It's a pretty basic (and frustrating!) control. Your best option may be to find a third-party control that does what you want.
For the option of typing the date and time manually, you could build a custom component with a TextBox/Date... |
We custom build our code generation using linq and XML literals (VB).
We haven't found a way to break the solutions into templates yet; however, those two technologies make this task so trivial, I don't think we will. |
Yes content of the file will be read then you run ComputeHash method and not when you just open a FileStream.
The best way to test where the performance problem is , it is to read data from file to memory stream hash it and measure performance of each of this steps. You can use System.Diagnostics.Stopwatch class for... |
Yes, you can use MageUI to create and modify manifests. The only thing is, every time you modify a manifest, it needs to be resigned. MageUI will prompt you to resign the manifest every time you make a change and attempt to save.
You can use a self-certificate to sign manifests. The only downside is the publisher... |
Debugging Web Service with SOAP Packet |