instruction stringlengths 0 30k ⌀ |
|---|
In your first example have you tried putting the
`vScrollBar.update();`
statement **after** the
`addChild(vScollbar);`
? |
A delegate is a Queue of function pointers, invoking a delegate may invoke multiple methods. A lambda is essentially an anonymous method declaration which may be interpreted by the compiler differently, depending on what context it is used as.
You can get a delegate that points to the lambda expression as a method b... |
Have you tried using "start (cmd)" for each command you are executing? |
Thanks for answering, David.
When the binding is removed, no wrapping occurs. The WrapPanel puts every group into a single vertical column.
The binding is meant to force the WrapPanel to actually wrap. If no binding is set, the WrapPanel assumes the height is infinite and never wraps.
Binding to MinHeight resu... |
@Petar: Thanks for your input. Yes, I am after that data that will be stored in the page after the Ajax calls. And, somehow the third party vendor will not give me that data via some JSON calls which I could directly call from my own WCF service.
|
**Expert C Programming: Deep C Secrets** by *Peter Van Der Linden* |
You could write a little Program that executes the command an returns a value (say -1 for an error). This value can then be used in your Batch-File. |
[SQLlite][1],
[Firebird][2],
and [SQL Server Compact Edition][3] (not Express)
all come to mind.
[1]: http://www.sqlite.org/
[2]: http://www.firebirdsql.org/
[3]: http://www.microsoft.com/sql/editions/compact/default.mspx |
[SQLlite][1],
[Firebird][2],
and [SQL Server Compact Edition][3] (not Express)
all come to mind.
Another thought: while the original question does ask about desktop databases, its likely some people will land here looking for a database to use with a web site. It's important to remember that these are all ... |
The following program serves to demonstrate a leaner algorithm for reversing bits, which can be easily extended to handle 64bit numbers.
#include <stdio.h>
#include <stdint.h>
int main(int argc, char**argv)
{
int32_t x;
if ( argc != 2 )
{
... |
Writing into excel file with OLEDB |
|c#|excel|oledb| |
Does anyone know how to write to an excel file (.xls) via OLEDB in C#? I'm doing the following:
OleDbCommand dbCmd = new OleDbCommand("CREATE TABLE [test$] (...)", connection);
dbCmd.CommandTimeout = mTimeout;
results = dbCmd.ExecuteNonQuery();
But I get an OleDbException thrown with messa... |
What is your experience with Sun CoolThreads technology? |
|solaris|coolthreads|sun| |
My project has some money to spend before the end of the fiscal year and we are considering replacing a Sun-Fire-V490 server we've had for a few years. One option we are looking at is the [CoolThreads](http://www.sun.com/servers/coolthreads/overview/index.jsp) technology. All I know is the Sun marketing, which may no... |
|hardware|solaris|sun|coolthreads| |
What is the overhead cost associated with IoC containers like StructureMap? |
|c#|inversion-of-control|structuremap| |
After attending a recent Alt.NET group on IoC I got to thinking about the tools available and how they might work. StructureMap in particular uses both attributes and bootstrapper concepts to map requests for IThing to ConcreteThing. Attributes automatically throw up flags for me that either reflection or IL injectio... |
It might be useful to think of HTML controls as an option when you want more control over the mark up that ends up getting emitted by your page. More control in the sense that you want EVERY browser to see exactly the same markup.
If you create System.Web.UI.HtmlControls like:
<input id='btnCancel' runat='ser... |
Is it possible to make a recursive SQL query ? |
|sql| |
I have a table similar to this:
CREATE TABLE example (
id integer primary key,
name char(200),
parentid integer,
value integer);
I can use the parentid field to arrange data into a tree structure.
Now here's the bit I can't work out. Given a parentid, is it possible to write an ... |
|sql|recursion| |
|sql|postgresql|recursion| |
I have a table similar to this:
CREATE TABLE example (
id integer primary key,
name char(200),
parentid integer,
value integer);
I can use the parentid field to arrange data into a tree structure.
Now here's the bit I can't work out. Given a parentid, is it possible to write an ... |
I'd use Java - its portable so future processors wont be a problem. I'd also code my application with layers seperating interface / logic and data (more like 3 tier web app) with standard mutex routines as a library (less debugging of parallel code). Remember that web servers scale to many processors really well and a... |
I'm sorry no, Eager Loading will execute one extra query per tag per post.
Tested with this code:
var options = new DataLoadOptions();
options.LoadWith<Post>(p => p.PostTags);
options.LoadWith<PostTag>(pt => pt.Tag);
using (var db = new BlogDataContext())
{
db.LoadOptions = option... |
The mapreduce/hadoop paradigm is useful, and relevant. Especially for people who are used to languages like perl, the idea of mapping over an array and doing some action on each element should come pretty fluidly and naturally, and mapreduce/hadoop just takes it to the next stage and says that there's no reason that e... |
check:
[http://www.iqcontent.com/blog/2007/05/a-really-simple-metric-for-measuring-user-interfaces/][1]
> Here is a simple pre-launch check you
> should do on all your web
> applications. It only takes about 5
> seconds and one screeshot
>
> Q: “What percentage of your interface contains stuff that y... |
C#: Can I have a method return IEnumerator<T> and use it in a foreach loop? |
|c#|foreach|ienumerable|ienumerator| |
I need to set the height of every textbox on my form, some of which are nested within other controls. I thought I could do something like this:
private static IEnumerator<TextBox> FindTextBoxes(Control rootControl)
{
foreach (Control control in rootControl.Controls)
{
if (con... |
HTML, Javascript, enabling disabled radio buttons |
|javascript|html|inputradio| |
The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is *supposed* to disable radio buttons if you select the "Disable 2 radio buttons" option. It should enable the radio buttons if you select the "Enable both radio buttons" option. These both work...
H... |
The following program serves to demonstrate a leaner algorithm for reversing bits, which can be easily extended to handle 64bit numbers.
#include <stdio.h>
#include <stdint.h>
int main(int argc, char**argv)
{
int32_t x;
if ( argc != 2 )
{
... |
The following program serves to demonstrate a leaner algorithm for reversing bits, which can be easily extended to handle 64bit numbers.
#include <stdio.h>
#include <stdint.h>
int main(int argc, char**argv)
{
int32_t x;
if ( argc != 2 )
{
... |
I love [IntelliJ][1], but it's commercial. Eclipse feels like a buggy, half-hearted knockoff compared to it. To the point that IntelliJ's worth the cost.
[1]: http://www.intellij.com |
Can you provide an example of a byte buffer transferred between two java classes via UDP datagram? |
|java|udp|datagram| |
see title? |
"This word is overloaded so much in our industry. If you mean something like MFC or .Net then I think they are here to stay. They have nothing to do with performance at runtime. They have everything to do with code reuse, maintainability and separation of concerns."
I have to say they do have a lot to do with perfor... |
I'm betting on communicating event loops with promises, as realized in systems like [Twisted](http://twistedmatrix.com), [E](http://erights.org), [AmbientTalk](http://prog.vub.ac.be/amop/start), and others. They retain the ability to write code with the same execution-model assumptions as non-concurrent/parallel applic... |
Ok I'm adding some additional solution notes. If you use the solution above you also need to insert a draw handler for the column headers, otherwise they won't paint. The selected item rectangle also looks funny so you'll want to check for that in the lv_DrawItem function and implement a similar solution. Remeber tha... |
Try [NetBeans][1]
> A free, open-source Integrated
> Development Environment for software
> developers. You get all the tools you
> need to create professional desktop,
> enterprise, web, and mobile
> applications with the Java language,
> C/C++, and Ruby.
[1]: http://www.netbeans.org/ |
If you do not need lazy loading then simply try
public class Singleton {
private final static Singleton INSTANCE = new Singleton();
private Singleton() {}
public static Singleton getInstance() { return Singleton.INSTANCE; }
public Object clone() {
... |
[GNU Emacs][1] is my preferred text editor and it works well on Windows (copy/paste actually works as expected) It's also available on all major platforms so you can reuse your knowledge if you jump around OSes like I tend to do.
I really like [JEdit][2] as well. It's a good text editor for code and random text. It'... |
You could loop through the zip files, reading individual files using the zipfile module and running your regex on those, eliminating to unzip all the files at once.
I'm fairly certain that you can't run a regex over the zipped data, at least not meaningfully. |
As of .NET 3.5 there's a formalized, baked-in way to create and load plugins from a .NET application. It's all in the [System.AddIn][1] namespace. For more information you can check out this article on MSDN: [Add-ins and Extensibility][2]
[1]: http://msdn.microsoft.com/en-us/library/system.addin.aspx
[2]: htt... |
I am not sure how much experience you have with version control systems, but for someone who has no prior knowledge about the concept I recommend reading the first few chapters of the <a href="http://svnbook.red-bean.com/">Subversion book</a>. Some of the things described there are specific to Subversion, but many of t... |
Using OpenGL textures larger than window/display size |
|opengl|textures| |
I'm having problems using textures that are larger than the OpenGL window or the display size as non-display render targets. What's the solution for this problem? |
There's a simple solution.
Assuming your (non-display) textures are **1024x1024** and you are restricted to a **256x256** window/display.
unsigned int WIN_WIDTH = 256;
unsigned int WIN_HEIGHT = WIN_WIDTH;
unsigned int TEX_WIDTH = 1024;
unsigned int TEX_HEIGHT = TEX_WIDTH;
Use the *window siz... |
The following program serves to demonstrate a leaner algorithm for reversing bits, which can be easily extended to handle 64bit numbers.
#include <stdio.h>
#include <stdint.h>
int main(int argc, char**argv)
{
int32_t x;
if ( argc != 2 )
{
... |
I mostly write C code and I tend to order by dependency. If possible I try to match my source code file with me header files, but generally it's if void a() uses int b(char *foo), than int b(char *foo) comes first.
Saves me from adding entries to the header file for local functions.
For the rest it's mainly alpha... |
There is more to choosing an RDBMS solution that just "back end horsepower". The ability to have commitment control, for example, so you can roll back a failed transaction is one. reason.
Unless you are in the megatransaction rate application, most database engines would be adequate - so it becomes a question of ho... |
I think you're being overly specific in your rankings. You can pretty much start with flat files and the like for very small data sets, go up to something like DBM for slightly bigger ones that don't require SQL-like syntax, and go to some kind of SQL database after that.
But who wants to do all that rewriting? If t... |
Keep one "master" source root that builds under JDK 5. Add a second parallel source root that has to build under JDK 6 or higher. (There should be no overlap, i.e. no classes present in both.) Use an interface to define the entry point between the two, and a tiny bit of reflection.
For example:
---%<--- main/... |
Run it inside another command instance with `CMD /C`
CMD /C vmware-cmd C:\...
This should keep the original BAT files running. |
Note, the _original_ string is left untouched, Trim will return you a new string:
string s1 = ",abc,d";
string s2 = s1.Trim(",".ToCharArray());
Console.WriteLine("s1 = {0}", s1);
Console.WriteLine("s2 = {0}", s2);
prints:
s1 = ,abc,d
s2 = abc,d
|
Note, the _original_ string is left untouched, Trim will return you a new string:
string s1 = ",abc,d";
string s2 = s1.TrimStart(",".ToCharArray());
Console.WriteLine("s1 = {0}", s1);
Console.WriteLine("s2 = {0}", s2);
prints:
s1 = ,abc,d
s2 = abc,d
|
I would try using the [EMBED][1] tag. I'm not too surprised that OBJECT doesn't work, as invoking an ActiveX control is a potential "security hole" of sorts in the email system. I'm not sure that EMBED would work either though, and that's probably by design. Many users would find that behavior undesirable (their ema... |
foreach(var row in DataGrid1.Rows)
{
DoStuff(row);
} |
foreach(var row in DataGrid1.Rows)
{
DoStuff(row);
}
foreach(DataGridRow row in DataGrid1.Rows)
{
DoStuff(row);
} |
foreach(var row in DataGrid1.Rows)
{
DoStuff(row);
}
foreach(DataGridRow row in DataGrid1.Rows)
{
DoStuff(row);
}
for(int i = 0; i< DataGrid1.Rows.Count - 1; i++)
{
DoStuff... |
There are more than a few people who don't like `break` and `continue`. The latest complaint I saw about them was in _JavaScript: The Good Parts_ by Douglas Crockford. But I find that sometimes using one of them really simplifies things, especially if your language doesn't include a `do-while` or `do-until` style of lo... |
Have you looked at the .NET Framework Client Profile? It is much smaller than the full redistributable package and is optimized for delivering just the functionality needed for smart clients.
[Here is a nice overview.][1]
I don't know if this will keep the download under two minutes or not, but it should get you ... |
Also, it is worth including (in some fashion) the Service Pack downloads as well. In fact, depending on how your executables are built, you might be forced to install the Framework and the Service Packs. |
A really easy way to understand this is to place the word "loop" after each of the keywords. The terms now make sense they are just read like everyday phrases.
break loop - looping is broken and stops
continue loop - loop continues to execute with the next iteration |
A really easy way to understand this is to place the word "loop" after each of the keywords. The terms now make sense if they are just read like everyday phrases.
break loop - looping is broken and stops
continue loop - loop continues to execute with the next iteration |
Once .NET Framework 3.5 SP1 comes out (should be fairly soon) there will be a second option of frameworks, namely the "Client Profile", which is a cut-down framework that only weighs in about about 30Mb from memory. It doesn't include all of the namespaces and classes of the full framework, but should be enough for mos... |
If you do not need lazy loading then simply try
public class Singleton {
private final static Singleton INSTANCE = new Singleton();
private Singleton() {}
public static Singleton getInstance() { return Singleton.INSTANCE; }
protected Object clone() {
... |
Once you read the docs Dave mentioned, if you have some insight on how it could have been more approachable or gotten you off on the right foot (or simply been easier to find), perhaps you would like to contribute that to the documentation. The developers cannot really read the introductory documentation from a new us... |
No one else has answered this, so I'll answer the part I can: the original Macintosh debugger was <a href="http://en.wikipedia.org/wiki/MacsBug">MacsBug</a>.
So far as the kipper quote goes, the only thing that comes to mind is the <a href="http://vx.netlux.org/lib/ars08.html#c236">Pathogen</a> computer virus. |
Partial, hopefully helpful answer to
> 4<code></code>. I find it a huge hassle that the workspace is in a different place than my source code. I have other files I need to edit (xml files, etc), and for each directory I want to edit files in, I need to set up a special entry, and it doesn't even default to where my so... |
Yes.
I recently joined a team of Rails developers who did not focus on database constraints such as foreign keys.
Luckily, I found these: [http://www.redhillonrails.org/foreign_key_associations.html][1] -- RedHill on Rails plug-ins generate foreign keys using the "Convention over Configuration" style. A migrati... |
Yes. The ON DELETE [RESTRICT|CASCADE] keeps developers from stranding data, keeping the data clean.
I recently joined a team of Rails developers who did not focus on database constraints such as foreign keys.
Luckily, I found these: [http://www.redhillonrails.org/foreign_key_associations.html][1] -- RedHill on ... |
Try Ctrl-NumPad + ?
([from here](http://www.vim.org/tips/tip.php?tip_id=305)) |
An article from [Power of Two Games][1] was mentioned in another answer already, but I suggest reading everything (or nearly everything) there, as they are all really well-written and apply directly to games development. The [article on Assert][2] is particularly good. You can also visit their previous website at [Ga... |
Unfortunately, different versions of the Java Plug-In have different caching behaviors. Setting your Cache-Control and Last-Modified HTTP headers is the ideal solution, but it only works under <a href="http://java.sun.com/javase/6/docs/technotes/guides/deployment/enhancements.html">the most recent versions</a> of the J... |
I would try using [DWR][1] to integrate JavaScript with your Java app. It makes Java to JavaScript communication transparent and only requires one servlet + configuration of what to expose. I haven´t done this with JMS, but it should work the same. There are three technologies that together solve all my integration pro... |
It sounds to me like you need to sit down and re-think your approach here. I cannot imagine a single reason your public methods need to be in a form if you are not going to show it. Just make a new class. |
You can see if the string matches the number.number.number.number format, for example:
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
will match anything from 0 - 999.
Anything else you can have it default to hostname. |
Do we get to make the assumption that it _is_ one or the other, and not something completely different? If so, I'd probably use a regex to see if it matched the "dotted quad" format.
|
I think the way to go is to write your service in C++ (I am assuming you did all the homework and there is a good reason you want to write in C++) and then front it using an RPC server. Use something like Thrift or Protobufs for a fast RPC implementation.
Now write your web frontend in the language of your choice -... |
Couldn't you just to a regexp match on it?
|
How should I detect unnecessary #include files in a large C++ project? |
|c++|visual-studio-2008|header|include|dependencies| |
I am working on a large C++ project in Visual Studio 2008, and there are a lot of files with unnecessary #include's. Sometimes the #include's are just artifacts and everything will compile fine with them removed, and in other cases classes could be forward declared and the #include could be moved to the .cpp file. Ar... |
Garbage collection is faster (more time efficient) than reference counting, if you have enough memory. For example, a copying gc traverses the "live" objects and copies them to a new space, and can reclaim all the "dead" objects in one step by marking a whole memory region. This is very efficient, *if* you have enough ... |
I think you can try with:
rsync -azvu -e ssh user@host1:/directory/ user@host2:/directory2/
(and I assume you are on host0 and you want to copy from host1 to host2 directly)
If the above does not work, you could try:
ssh user@host1 "/usr/bin/rsync -azvu -e ssh /directory/ user@host2:/directory2/"
i... |
[Picasa][1] is a pretty great/free photo management app. It let's you do some pretty impressive editing, and has upload capabilities, though I can't remember if it will upload to anywhere, or just certain popular sites (like Flickr).
[1]: http://picasa.google.com/ |
@ΤΖΩΤΖΙΟΥ
In reply to ΤΖΩΤΖΙΟΥ 's comments, I present modified version of above which depends on a upper limit for bit width.
#include <stdio.h>
#include <stdint.h>
typedef int32_t TYPE;
TYPE reverse(TYPE x, int bits)
{
TYPE m=~0;
switch(bits)
{
case 64:
x ... |
What is the easiest way to wrap a raw .aac file into a .m4a container |
|ruby-on-rails|aac|containers|m4a| |
This question is overflow from the following question:
http://stackoverflow.com/questions/70096/how-do-i-programmatically-convert-mp3-to-an-itunes-playable-aacm4a-file
Anyway, I learned how to create an aac file and then i found out that an aac is not just an m4a file with a different file extension. In fact, I ... |
I would recommend Excel too. It is an environment that your users are familiar with anyway, and they will be able to perform additional analysis (totals etc) without learning any new interfaces.
However, I would advise against pivot tables as a method of getting the data into Excel. I once worked on a project using ... |