instruction stringlengths 0 30k ⌀ |
|---|
I really don't think it comes down to recursion vs. looping, both are prone to problems as the dataset grows and if the random number generation is not correctly implemented. Two ideas come to mind:
1. GUID
If a truly unique id is required with as little effort as possible, consider a GUID, your DB will most lik... |
I really don't think it comes down to recursion vs. looping, both are prone to problems as the dataset grows and if the random number generation is not correctly implemented. Two ideas come to mind:
. GUID
If a truly unique id is required with as little effort as possible, consider a GUID, your DB will most like... |
You cant, as you can't control how the html client response.
Actually why you need to do so? As long as no one can pick up the session to use again, it would expire after that 20 minutes. If resources does matter, set a more aggressive session expiry (most hosting companies did that, which is horribly annoying) or ... |
How to programatically create videos ? |
|linux|video|mpeg| |
Is there a freely available library to create a MPEG (or any other simple video format) out of an image sequence ?
It must run on Linux too, and ideally have Python bindings. |
Mockrunner (http://mockrunner.sourceforge.net/index.html) can do this. It provides a mock J2EE container that can be used to test Servlets. It can also be used to unit test other server-side code like EJBs, JDBC, JMS, Struts. I've only used the JDBC and EJB capabilities myself. |
It seems I have nothing to really add to what hasn't already been written.
I use it extensively, especially when remote people are involved in development. Without it your real time communication dies. It is the only viable method of communication that isn't as interruptive as phone calls or something of that natu... |
Can you clarify what you mean by structure?
Right now, I am assuming you mean the overall architecture. You can accomplish it by not sharing memory between processes, and by using an actor model for your processes. |
I had similar problems in my burndown as well. I "fixed" it by refining what was included in the burndown.
SiKeep commented:
> Its progress against the backlog
> selected for that sprint, which may or
> may not end up as a release.
Since you selected certain things for the sprint and that's what is on the bur... |
Try [Web Profile Builder][1]. It's a build script that automagically generates a WebProfile class (equivalent to ProfileCommon) from web.config.
[1]: http://code.msdn.microsoft.com/WebProfileBuilder |
Not a library, but mplayer has the ability to encode JPEG sequences to any kind of format. It runs on Linux, Windows, BSD and other platforms and you can write a python script if you want to use it with python. |
Bytes from disk should be read when the caller requests them by invoking Read or similar methods. At any rate, both the hard disk and the operating system perform some read-ahead to improve sequential read operations, but this is surely hard to predict.
You could also try to play with the buffer size parameter that ... |
Generally it will be because reading/writing to it is faster that way. But almost every compiler has a switch to turn this off. In gcc its -malign-???. With aggregates they are generally aligned and sized based on the alignment requirements of each element within. |
How to add monsters to a Pokemon game? |
|visualbasic| |
My friends and I are starting a game like Pokemon and we wanted to know how will we add monsters to the game? We're using VisualBasic because my friend's brother said it would be easier.
So far we can put pictures of the monsters on the screen and you can click to attack and stuff.
Right now when we want to add ... |
|visualbasic|offtopic| |
|visualbasic| |
|vb| |
Test Coverage for visual basic project |
|visualbasic| |
We are developing a visual basic 6.0 project.We have written a library, which we were testing using vbunit and vbmock.But, soon found that the tests were not maintainable.So, we decided to write tests using MBunit.Now, we want to know the test coverage.How can we do it?
thanks |
|vb| |
[I have no idea how to get exactly the information you asked for, but...] Maybe you could rephrase (for yourself) what you try to accomplish? Like, instead of asking "does the user have broadband or dialup", ask "how much bandwidth does the user's internet connection have" - and then you can try to answer the rephrased... |
The expression between the <%= %> is evaluated before the c:if tag is evaluated. So, supposing that |request.isUserInRole| returns |true|, your example would be evaluated to this first:
<c:if test="true">
<li>user</li>
</c:if>
and then the c:if tag would be executed. |
Languages like LISP (and the very closely related Scheme) are to programming what Latin is to English.
You may never speak Latin a day in your normal life again after taking a course, but simply learning a language like Latin will improve your ability to use English.
The same is true for Scheme. |
I was under the impression that the first *formalized* concept of interfaces came from Objective-C. I can tell you for sure that Java at least got the idea from Objective-C, so it wasn't Java that had interfaces at least.
[Email from Patrick Naughton][1]
[1]: http://cs.gmu.edu/~sean/stuff/java-objc.html |
I was under the impression that the first *formalized* concept of interfaces came from Objective-C (called "protocols"). I can tell you for sure that Java at least got the idea from Objective-C, so it wasn't Java that had interfaces first.
[Email from Patrick Naughton][1]
[1]: http://cs.gmu.edu/~sean/stuff/j... |
Flex is basically a language that compiles down to a flash "movie" or "applet", that will run in the Adobe Flash player plugin. |
Would it be useful to have method return values for null objects? |
|java|c#| |
Would it be useful to be able to provide method return value for null objects?
For a List the null return values might be:
<pre>
get(int) : null
size() : 0
iterator() : empty iterator
</pre>
That would allow the following code that has less null checks.
<pre>
List items = null;
if(s... |
|c#|java| |
Would it be useful to be able to provide method return value for null objects?
For a List the null return values might be:
get(int) : null
size() : 0
iterator() : empty iterator
That would allow the following code that has less null checks.
List items = null;
if(something) {
... |
If you are running in *iehta mode then you are going to run into some glitches here and there. We run Selenium at my job and there seem to be lots of issues with IE and AJAX.
However, it sounds like the issue you are running into is one where Selenium is trying to access a component in another window before it compl... |
How to determine whether a character is a letter in Java? |
|java|unicode| |
How do you check if a one-character String is a letter - including any letters with accents?
I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me.
|
Hum it can tricky. Bring the "server" view. If your project has already been deployed, remove it from the server to clean the binding between your project and the server.
Or you can right-click on your project in the project explorer and choose debug on the server. If you don't done it already, Eclipse should ask yo... |
The first alternative is to copy shared master page files into a single location on an IIS web server. Each application can then create a virtual directory as a subdirectory and point the virtual directory to the real directory of master pages. The applications can then set the MasterPageFile property of a page to th... |
I know there's [mencoder][1] (part of the mplayer project), and [ffmpeg][2], which both can do this.
[1]: http://www.mplayerhq.hu/design7/news.html
[2]: http://ffmpeg.mplayerhq.hu/ |
The following document linked from [the draft RFC][1] mentioned by [Jim][2] in [his answer][3] further addresses the question and definitely worth a direct note here:
[Test Cases for HTTP Content-Disposition header and RFC 2231/2047 Encoding][4]
[1]: http://greenbytes.de/tech/webdav/draft-reschke-rfc2231-in-h... |
How can I split a string using regex to return a list of values? |
|c#|regex| |
How can I take the string “foo[]=1&foo[]=5&foo[]=2” and return a collection with the values 1,5,2 in that order. I am looking for an answer using regex in C#. Thanks |
Some years ago I used `MarkupWriter` from [4suite][1]
> General-purpose utility class for generating XML (may eventually be
> expanded to produce more output types)
>
> Sample usage:
>
> from Ft.Xml import MarkupWriter
> writer = MarkupWriter(indent=u"yes")
> writer.startDocument... |
They are composable. This is possible because LINQ queries are actually expressions (code as data), which LINQ providers like LINQ-to-SQL can evaluate and generate corresponding SQL.
Because LINQ queries are lazily evaluated (e.g. won't get executed until you iterate over the elements), the code you showed won't act... |
Regarding whether or not short-circuiting is efficient, pipelining is unlikely to have much of an impact on performance. In situations where it could have an impact, there's nothing to stop the compiler from testing multiple conditions in parallel so long as these tests doesn't have side-effects. Plus, modern CPUs have... |
Is there a tool to convert a .vim colour definition file to use in VS.NET 2008 |
|visual-studio|vim|syntax-highlighting| |
If you go to a site such as:
[http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/index-c.html][1]
It has a bunch of example colour themes for VI.
Does anyone know of a tool that would take those files and convert them into .vssettings files to use in Visual Studio?
If not, how about some good docs on ether ... |
Yes, the resulting query is composed. It includes the full where clause. Turn on SQL profiling and try it to see for yourself.
Linq does this through expression trees. The first linq statement produces an expression tree; it doesn't execute the query. The second linq statement builds on the expression tree created b... |
How to call external command in Python |
|python|command|external| |
I want to be able to call external command in Python.
Thanks for your help! |
One common suggestion related to original topic - please use TryParse as soon as you not really sure that input string parameter WILL be correct number format representation. |
Microsoft Sharepoint |
|sharepoint| |
I hear the name Microsoft Sharepoint being thrown around a lot yet I am still not sure what its for and why I hear a lot of big companies use it. In short, the questions are, what is sharepoint and why is it popular? |
What is Microsoft Sharepoint? |
How to hide complete volume? |
|windows|system-administration|windows-server-2003| |
Using Windows Server 2003 in a multi-user environment (via Remote Desktop, using it as an application server), how to mount a (preferably encrypted) volume in a way, that won't show up on any other user's desktop?
Tried, and failed approaches:
- tweaking user rights -display of mounted volume can not be changed.
... |
I found the answer here:
[http://blog.domaindotnet.com/2008/08/24/nhibernate-20-gold-released-must-wait-for-linq-to-nhibernate/][1]
<h1>gold release 2.0.0.GA</h1>
<h2>BREAKING CHANGES from NH1.2.1GA to NH2.0.0</h2>
<ul>
<li>
<h2>Infrastructure</h2>
<ul>
<li>.NET 1.1 is no longer supported</li>
<li>Nullab... |
Yes, you can find a wrapper here:
http://sqlite.phxsoftware.com/
"System.Data.SQLite is the original SQLite database engine and a complete ADO.NET 2.0 provider all rolled into a single mixed mode assembly. It is a complete drop-in replacement for the original sqlite3.dll (you can even rename it to sqlite3.dll). ... |
For the divs, you just need to float left and the li, you want to do a clear. So:
li
{
clear: left;
}
.a
{
float: left;
}
.b
{
float: left;
} |
7-Zip commandline switch |
|7zip| |
Is there a 7-zip commandline switch that prevents the filenames from echoing to the screen as they are added to the archive? |
**In theory**
- A *[suffix array][1]* is the 'best' answer since it can be implemented to use linear space and time to detect any duplicate substrings. However - the naive implementation actually takes time O(n^2 log n) to sort the suffixes, and it's not completely obvious how to reduce this down to O(n log n), ... |
// try enter will return false if another thread owns the lock
if (Monitor.TryEnter(lockObj))
{
try
{
// check last write time here, return if too soon; otherwise, write
}
finally
{
Monitor.Exit(lockobj);
... |
The technical details don't matter to me - if the semantics remain the same and, for all intents and purposes, the function acts as if it were really a partially-applied function, who cares?
I used to be as academic about things, but worrying about such particulars doesn't get real work done in the end.
Person... |
Thanks for the advice, the pointer is to an C style abstract structure which I think if I leave that structure exposed to the managed code is going to cause further pain due to its lack of defined structure. So what I think I will do is wrap the C library in C++ and then wrap the C++ wrapper with managed C++, which wi... |
I'm using Subsonic's migrations mechanism so I just have a dll with classes in squential order that have 2 methods, up and down. There is a continuous integration/build script hook into nant, so that I can automate the upgrading of my database.
Its not the best thign in the world, but it beats writing DDL. |
@Thomas Owens PowerShell is now part of the Common Engineering Criteria (as of Microsoft's 2009 Product Line) and starting with Serve 2008 is included as a feature. It stands as much of a chance to be installed as Python or Ruby. You also mentioned that you were willing to go to C#, which could use TagLibSharp. Or y... |
If you want something quick and dirty I would suggest using Stopwatch instead for a greater degree of precision. If you need something a little more sophisticated you should probably consider using a 3rd party profiler such as [ANTS][1].
Here a screenshot of it showing line-by-line profiling:
![alt text][2]
... |
If you want something quick and dirty I would suggest using Stopwatch instead for a greater degree of precision.
Stopwatch sw = new Stopwatch();
sw.Start();
// Do Work
sw.Stop();
Console.WriteLine("Elapsed time: {0}", sw.Elapsed.TotalMilliseconds);
Alternatively, if you need somethin... |
@Thomas Owens TagLibSharp is a nice library to use. I always lean to PowerShell first, one to promote the language, and two because it is spreading fast in the Microsoft domain. I have nothing against using other languages, I just lean towards what I know and like. :) Good luck with your project. |
Finding controls that use a certain interface in ASP.NET |
|asp.net|c#| |
Having a heckuva time with this one, though I feel I'm missing something obvious. I have a control that inherits from System.Web.UI.WebControls.Button, and then implements an interface that I have set up. So think...
public class Button : System.Web.UI.WebControls.Button, IMyButtonInterface { ... }
In the cod... |
If I read the spec correctly the automatic `serialVersionUID` shouldn't change if you change the value of a static of transient field. Take a look at [Chapter 5.6][1] of the Spec.
**However**, if you think about this a bit - you start by serializing an object that has `static int MYINT = 3`, when you then deserializ... |
@aku: One example is code reviews. Another example is refactoring scenarios.
Basically I don't want to go type-hunting with my mouse. It might not be available. |
You might also consider [boost::any][1]. I've used it for heterogeneous containers. When reading the value back, you need to perform an any_cast<T>. It will throw a bad_any_cast if it fails. If that happens, you can catch and move on to the next type.
[1]: http://www.boost.org/doc/libs/1_36_0/doc/html/any.html |
You might also consider [boost::any][1]. I've used it for heterogeneous containers. When reading the value back, you need to perform an any_cast<T>. It will throw a bad_any_cast if it fails. If that happens, you can catch and move on to the next type.
I *believe* it will throw a bad_any_cast if you try to any_cast a... |
You might also consider [boost::any][1]. I've used it for heterogeneous containers. When reading the value back, you need to perform an any_cast<T>. It will throw a bad_any_cast if it fails. If that happens, you can catch and move on to the next type.
I *believe* it will throw a bad_any_cast if you try to any_cast a... |
You might also consider [boost::any][1]. I've used it for heterogeneous containers. When reading the value back, you need to perform an any_cast<T>. It will throw a bad_any_cast if it fails. If that happens, you can catch and move on to the next type.
I *believe* it will throw a bad_any_cast if you try to any_cast a... |
preceeded or followed by?
If it's anything starting with 'abc ' that's not (immediately) followed by 'defg', you want [bmdhacks' solution](http://stackoverflow.com/questions/96826/vim-how-do-i-exclude-an-entire-word-from-my-search#97008).
If it's anything starting with 'abc ' that's not (immediately) preceeded by... |
how to check if a directory exists in a makefile |
|directory|makefile|exists| |
I need to generate a directory in my makefile and I would like to not get the "directory already exists error" over and over even though I can easily ignore it.
I mainly use mingw/msys but would like something that works across other shells/systems too.
I tried this but it didn't work, any ideas?
ifeq (,$... |
There's also
long timestamp = System.currentTimeMillis()
which is what `new Date()` (@[John Millikin][1]) uses internally. Once you have that, you can format it however you like.
[1]: http://stackoverflow.com/questions/99098/generate-a-current-datestamp-in-java#99105 |
I took on a assembly class doing mips about two years ago. I found myself writing GameBoy Advance games in a mips-like asm language. Can't say I enjoyed it.
Though I think it is good to have an understanding about the inner workings of assembled code (from high level to low level). I feel it made me understand more... |
Casting is an explicit instruction to the Java compiler to ignore type safety so allowing automatic casts would remove one of the features purposely designed into the language.
I personally like compiler warnings and errors, since it's much harder to find this type of problem at run time (assuming the compiler someh... |
I would avoid it, because I have a feeling it will come back and bite you later on. Generics are worth the hassle, in my opinion, because they save lots of headache down the road. Also, it's not too hard to use a "container" object for collections that hold different object types. |
Use the INSERT INTO SELECT sentence to bulk from prod tables to your test environment avoiding your test fields that doesn't match in prod. |
final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd:hh-mm-ss");
formatter.format(new Date());
The [JavaDoc for SimpleDateFormat](http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html) provides information on date and time pattern strings. |
li { width: 100%;}
.a { float: left;}
.b { float: left;} |
Here are the ones I can find:
- [managed-sqlite][1]
- [SQLite.NET wrapper][2]
- [System.Data.SQLite][3]
Sources:
- [sqlite.org][4]
- other posters
[1]: http://code.google.com/p/managed-sqlite/
[2]: http://www.phpguru.org/static/SQLite.NET.html
[3]: http://sqlite.phxsoftware.com/
[4]:... |