instruction stringlengths 0 30k ⌀ |
|---|
|python|http|zip| |
I need to read selected files, matching on the file name, from a remote zip archive using Python. I don't want to save the full zip to a temporary file (it's not that large, so I can handle everything in memory).
I've already written the code and it works, and I'm answering this myself so I can search for it later. ... |
Write them out on labels and stick them up on a board - it works :) Also Scrum really does not give you overhead - it works pretty well and is very satisfying for all team members imho :) |
better still used a list
<fieldset class="classname">
<ul>
<li>
<label>Title:</label>
<input type="text" name="title" value="" />
</li>
</ul>
</fieldset>
the set the li tags width wide enough for both label and input and float the label to the left.
also t... |
better still use a list
<fieldset class="classname">
<ul>
<li>
<label>Title:</label>
<input type="text" name="title" value="" />
</li>
</ul>
</fieldset>
the set the li tags width wide enough for both label and input and float the label to the left.
also to... |
better still use a list
<fieldset class="classname">
<ul>
<li>
<label>Title:</label>
<input type="text" name="title" value="" />
</li>
</ul>
</fieldset>
the set the li tags width wide enough for both label and input and float the label to the left.
also to... |
You could RegEx the files to search for
- "SELECT *"
- "UPDATE *"
- "DELETE FROM *"
- "INSERT INTO *"
|
Well, for me it was the fact that controls in WPF behave rather different from those in WPF (for example, when it comes to positioning in the form). You have to understand the difference as soon as possible to use it successfully and productively. |
Since I first worked with [mono osx][1], they've added Cocoa# and ObjC#, but the ASP.NET core was pretty solid (about 3 years ago). You can in fact write web applications according to the Onion book, and port 'em to IIS with little or no difficulty.
[1]: http://www.mono-project.com/Mono:OSX |
I use rackforce. I havnt had a problem with mine, but then i dont have anything large scale on it. One thing about them that is good is they are on a borderline of two powergrids and backbones.(so i have heard)
Just stay away from Webserve.ca. They are HORRIBLE, horrible support, they mess things up, slow to resolv... |
The best way to find good or bad references about a hosting service, is always googling and foruns. I always look for a good support and how flexible it's service provider is. One that i have as a development and staging server is in the "A small orange" http://www.asmallorange.com/services/vps/. They have even a devel... |
Its not built in. Here's an implementation; it relies on there being a Pair<T,U> class, the implementation of which is left as an exercise for the reader :).
IEnumerable<Pair<T, U>> Zip<T, U>(IEnumerable<T> first, IEnumerable<U> second)
{
IEnumerator<T> firstEnumerator = first.GetEnumerator();
I... |
Its not built in. Here's a C# 2.0 implementation.
IEnumerable<Pair<T, U>> Zip<T, U>(IEnumerable<T> first, IEnumerable<U> second)
{
IEnumerator<T> f = first.GetEnumerator();
IEnumerator<U> s = second.GetEnumerator();
while (f.MoveNext() && s.MoveNext())
yield return new Pair<T, U>(f.... |
Its not built in. Here's a C# 2.0 implementation.
IEnumerable<Pair<T, U>> Zip<T, U>(IEnumerable<T> a, IEnumerable<U> b)
{
IEnumerator<T> f = a.GetEnumerator();
IEnumerator<U> s = b.GetEnumerator();
while (f.MoveNext() && s.MoveNext())
yield return new Pair<T, U>(f.Current, s.Current... |
I also recommend ReCAPTCHA, both because it's a highly-reliable service you don't have to manage, and because it serves two common goods - the OCR tasks described by the ReCAPTCHA team, and the progress towards teaching people how captchas work, reducing abandonment rates. |
From McConnell:
http://www.codinghorror.com/blog/archives/000637.html
> [For a software project], size is easily the most significant determinant of effort, cost, and schedule. The kind of software you're developing comes in second, and personnel factors are a close third. The programming language and environment... |
It looks to me that the lock is unnecessary in your first case. Using the static initializer to initialize bar is guaranteed to be thread safe. Since you only ever read the value, there's no need to lock it. If the value's never going to change, there will never be any contention, why lock at all? |
If you're doing this to transfer data between different platforms look at the ntoh and hton functions. |
Generics in .net, like inheritence and extension methods, allows for reduction of code duplication. Let me explain by way of refactoring.
If all classes with a common ancestor have a common method, place the common method in the classes' common ancestor (inheritence).
If some classes have a common method that us... |
Another disadvantage I've run into is on a Forms authenticated website using custom IPrincipal/IIdentity. Cassini will switch the AppDomains without warning (or notice).
http://www.lhotka.net/weblog/UpdateOnMyStrugglesWithTheASPNETDevelopmentServer.aspx
The headache on this made me drop Cassini and stick with IIS... |
Browser Detection |
|browser|detection|definitive| |
What's the best / simplest / most accurate way to detect the browser of a user?
Ease of extendability and implementation is a plus.
The less technologies used, the better. |
|browser|crossbrowser| |
|browser|detection| |
What's the best / simplest / most accurate way to detect the browser of a user?
Ease of extendability and implementation is a plus.
The less technologies used, the better.
The solution can be server side, client side, or both. The results should eventually end up at the server, though. |
What's the best / simplest / most accurate way to detect the browser of a user?
Ease of extendability and implementation is a plus.
The less technologies used, the better.
The solution can be server side, client side, or both. The results should eventually end up at the server, though.
The solution can be f... |
|browserdetection| |
|browser-detection| |
|browser-detection| |
|browser|browser-detection| |
One solution that works is to create a `.bat` file that will open cygwin and execute your script.
The script to execute the script `go.sh` located on my home directory:
@echo off
C:
chdir C:\cygwin\bin
bash --login -i ./go.sh |
I've been using [ Web Development Helper ][1] lately. It does HTTP logging better than Firebug. Lets you run arbitrary Javascript as well.
[1]: http://projects.nikhilk.net/WebDevHelper/Default.aspx |
It's GPL version 2 and you may certainly **not** close its source. |
It depends what you classifies as a console. The iPod Touch and the iPhone has got the iPhone SDK with which it should be possible to develop quite good games and when you're done they can easily be distributed through App Store either fer free or for a price of which you will be given 70%. |
Hands down the best IDE for PHP is NuSphere PHPEd. It's a no contest. It is so good that I use WINE to run it on my Mac. PHPEd has an awesome debugger built into it that can be used with their local webserver (totally automatic) or you can just install the dbg module for XAMPP or any other Apache you want to run. |
It is [GPL][1]. Short answer -- no.
[1]: www.gnu.org/copyleft/gpl.html |
http://www.debian-administration.org/articles/34
I wrote that a couple of years ago, but it is still a good introduction that gets a lot of positive feedback. |
If the behavior is similar to opening an Application, all you need to do is click the Open/Save dialog and the Open button will become available about a second later. Does this help? |
Not as widely documented and supported as XNA, but here are some libraries with documentation/wiki's for the handheld consoles.
- GameBoy Advance: [HAM][1]
- Nintendo DS: [PAlib][2], [devkitPro][3] (the basis for pretty much all homebrew on the DS)
[1]: http://www.aaronrogers.com/ham/
[2]: http://www.pa... |
For encryption, you should probably use [read()][1]. Encryption algorithms usually deal with fixed-size blocks. Oh, and to open in binary mode (no translation frmo \n\r to \n), pass ios_base::binary as the second parameter to constructor or open() call.
[1]: http://www.cplusplus.com/reference/iostream/istream/re... |
The simplest and shortest explanation that I have found is: "The Semantic Web is to Machines what the World Wide Web is to Humans".
And as to why you would want that: for the same reasons why you let your Machine compute Pi to the quadrillionth digit instead of doing that yourself. So you can focus on *interesting* ... |
I think that the best way to show that you really understand the client idea is to build prototypes.
By the way I was present in the last edition of the Requirements Engineering conference and in one of the workshops (MERE), Siemens was showing and interesting software based on composing a video of the client idea (... |
off the top of my head...
**Functions**
arguments.callee refers to the function that hosts the "arguments" variable, so it can be used to recurse anonymous functions:
var recurse = function() {
if (condition) argument.callee(); //calls recurse() again
}
That's useful if you want to do someth... |
The clearest way I can say this is:
**Don't waste your time writing automated GUI tests**.
Especially when your working with an MVC app - in your case, when you send a message to the server, you can make sure the right message number comes back and be done. You can add some additional cases - or another test com... |
I work at an imaging vendor and wrote an adapter for WPF to our image format which is similar to a System.Drawing.Bitmap.
I wrote this KB to explain it to our customers:
[http://www.atalasoft.com/kb/article.aspx?id=10156][1]
And there is code there that does it. You need to replace AtalaImage with Bitmap and ... |
I recall reading in several reference books that the if/else branching is quicker than the switch statement. However, a bit of research on Blackwasp shows that the switch statement is actually faster:
http://www.blackwasp.co.uk/SpeedTestIfElseSwitch.aspx
In reality, if you're comparing the typical 3 to 10 (or so) s... |
- One Owner
- boost::scoped_ptr
When you need to allocate memory dynamically but want to be sure it gets deallocated on every exit point of the block.
I find this usefull as it can easily be reseated, and released without ever having to worry about a leak |
From the [FAQ][1]:
>Sometimes the openssl command line utility does not abort with a "PRNG not seeded" error message, but complains that it is "unable to write 'random state'". This message refers to the default seeding file (see previous answer). A possible reason is that no default filename is known because neithe... |
From the [FAQ][1]:
>Sometimes the openssl command line utility does not abort with a "PRNG not seeded" error message, but complains that it is "unable to write 'random state'". This message refers to the default seeding file (see previous answer). A possible reason is that no default filename is known because neithe... |
How to programmatically determine param name when constructing an ArgumentException? |
|.net|reflection|duplication|refactoring| |
If you have to capture all the command output you can use a batch like this:
@ECHO OFF
IF NOT "%1"=="" GOTO ADDV
SET VAR=
FOR /F %%I IN ('DIR *.TXT /B /O:D') DO CALL %0 %%I
SET VAR
GOTO END
:ADDV
SET VAR=%VAR%!%1
:END
All output lines are stored in VAR separated with "!".
@John: is there... |
I wrote this a while back:
@rem = '--*-Perl-*--
@echo off
perl -x -S %0 %*
goto endofperl
@rem -- BEGIN PERL -- ';
#!d:/Perl/bin/perl.exe -w
#line 10
use strict;
#use Test::Setup;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
my $ignore_case = 0;
my $numbe... |
I wrote this a while back:
@rem = '--*-Perl-*--
@echo off
perl -x -S %0 %*
goto endofperl
@rem -- BEGIN PERL -- ';
#!d:/Perl/bin/perl.exe -w
#line 10
use strict;
#use Test::Setup;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
my $ignore_case = 0;
my $numb... |
Try this:
#!/usr/bin/env python
def get_all(D, k):
yield k
for ii in D.get(k, []):
for jj in get_all(D, ii):
yield jj
A = { 'a' : dict(b=1, c=1),
'c' : dict(d=1),
'd' : dict(e=1,f=1,g=1),
'h' : dict(j=1)
}
... |
Try this:
#!/usr/bin/env python
def get_all(D, k):
yield k
for ii in D.get(k, []):
for jj in get_all(D, ii):
yield jj
A = { 'a' : dict(b=1, c=1),
'c' : dict(d=1),
'd' : dict(e=1,f=1,g=1),
'h' : dict(j=1)
}
... |
Most virtual hosting platforms will have a trial period in which you can test out their reliability. They will also give you a list of their high profile sites on their systems. Most keep track of the traffic hogs as it's a great way for them to attest their own stability.
I would recommend [Slicehost][1] as I have ... |
FieldName objects should be contained in SPANs with style attributes of float: left, while field inputs should be styled to float: right. Place a <div style="clear: both"/> after each field input to break the floating.
You may enclose the aforementioned objects into a div with the width style attribute set. |
FieldName objects should be contained in SPANs with style attributes of float: left and a width that is wide enough for your labels.
Inputs should be contained within a span styled to float: left. Place a `<div style="clear: both"/>` or `<br/>` after each field input to break the floating.
You may enclose the afo... |
Most of the time I find googling for R plus my searching term works fine. When it doesn't, I'll try using "R project", or adding CRAN, statistic or language to the search.
Is there a particular topic that you're having problems searching for? |
I just started getting this tonight as well. Googling turned up a bunch of suggestions that didn't deliver results
gem update --system
and some paste in code from jamis that is supposed to replace a function in package.rb but the original it is supposed to replace is nowhere to be found.
Reinstalling rubygem... |
Actually we have been using Rational Team Test, then Robot, but in recent discussions with Rational we discovered they have no plans to support Native x64 applications focusing more on .NET, so we decided to switch Automated QA tools. This is great but licensing costs don't allow us to enable it for all developers.
... |
There is no simple solution for this. Name construction varies from culture to culture, and even in the English-speaking world there's prefixes and suffixes that aren't necessarily part of the name.
A basic approach is to look for honorifics at the beginning of the string (e.g., "Hon. John Doe") and numbers or some... |
you should try a count(*)
There is a difference between the two.
count(1) signifies count rows where 1 is not null
count(*) signifies count the rows |
You can do the obvious things: look for Jr., II, III, etc. as suffixes, and Mr., Mrs., Dr., etc. as prefixes and remove them, then first word is first name, last word is last name, everything in between are middle names. Other than that, there's no foolproof solution for this.
A perfect example is David Lee Roth (la... |
SQL Server Execution Plan!!! Go here: http://dbalink.wordpress.com/2008/08/08/dissecting-sql-server-execution-plans-free-ebook/ |
Get a copy of the book <a href="http://www.pragprog.com/titles/svn/pragmatic-version-control-using-subversion>Pragmatic Version Control Using Subversion</a> - it will help you get started. |
Get a copy of the book <a href="http://www.pragprog.com/titles/svn/pragmatic-version-control-using-subversion>Pragmatic Version Control Using Subversion</a> - it will help you get started.
![Image][1]
[1]: http://ecx.images-amazon.com/images/I/51XYQTP2BYL._SL500_AA240_.jpg |
I would say Strip out [salutations from a list][1] then split by space, placing list.first() as first name, list.last() as last name then join the remainder by a space and have that as a middle name. And ABOVE ALL display your results and let the user modify them!
[1]: http://snippets.dzone.com/posts/show/866 |
You can do so by analyzing the user dump file with WinGdb. Run the !peb command and look for the value of COMPUTERNAME in its output. |
Here's how to do it on the command line:
for file in `find . -name configure`; do
svn ps svn:executable yes ${file}
done
Or for just one file (<code>configure</code> is the filename here):
svn ps svn:executable yes configure |
Try using svcutil.exe instead. |
Trying out languages outside of your normal toolbox will give you new ways of approaching things in your current favorite language. Even if you don't use them for serious projects languages like Perl (for data mangling), Lisp ([functional programming][1]), and Javascript ([prototype based programming][2]) will teach yo... |
You don't want to directly edit the text in the TVITEM struct, the results are undefined. Instead, use the TVM_SETITEM message, or equivalently, use the TreeView_SetItem() macro defined in windowsx.h. |
If you're just writing a value to a pointer, you don't need to lock, since that action is atomic. Generally, you should lock any time you need to do a transaction involving at least two atomic actions (reads or writes) that depend on the state not changing between the beginning and end. |
If you're just writing a value to a pointer, you don't need to lock, since that action is atomic. Generally, you should lock any time you need to do a transaction involving at least two atomic actions (reads or writes) that depend on the state not changing between the beginning and end.
That said – I come from Java... |
In short, when comparing two floats with unknown origins, picking an epsilon that is valid is almost impossible.
For example:
What is a good epsilon when comparing distance in miles between Atlanta GA, Dallas TX and some place in Ohio?
What is a good epsilon when comparing distance in miles between my left foo... |
In short, when comparing two floats with unknown origins, picking an epsilon that is valid is almost impossible.
For example:
What is a good epsilon when comparing distance in miles between Atlanta GA, Dallas TX and some place in Ohio?
What is a good epsilon when comparing distance in miles between my left foo... |
In short, when comparing two floats with unknown origins, picking an epsilon that is valid is almost impossible.
For example:
What is a good epsilon when comparing distance in miles between Atlanta GA, Dallas TX and some place in Ohio?
What is a good epsilon when comparing distance in miles between my left foo... |
I think that's the only solution for Firefox... I have a better function for that function, it works even for Opera and shows a message for other "unsupported" browsers.
<script type="text/javascript">
function addBookmark(url,name){
if(window.sidebar && window.sidebar.addPanel) {
wind... |
I think that's the only solution for Firefox... I have a better function for that action, it works even for Opera and shows a message for other "unsupported" browsers.
<script type="text/javascript">
function addBookmark(url,name){
if(window.sidebar && window.sidebar.addPanel) {
window... |
I thing the largest amount on large projects are testing and fixing the bugs and fixing misinterpretation of the requirements. First you need write tests. Than you fix the code that the tests run. Than you make the manual tests. Then you must write more tests. On a large project the testing and fixing can consume 40-5... |
Characters, file size, and typing speed can be considered of zero cost, compared to proper problem definition, design and testing. They are easily an order of magnitude more important. |
Does anyone using Msmqdistributor service of Enterprise Library? |
|enterprise-library| |
We are using EntLib Logging Application Block. And also it turned out that we should use msmq for ligging because of performance.
Now we are trying to use Msmqdistributor service to log those messages in the queue.
What are pros and cons of Msmqdistributor service of Enterprise Library?
Please share your exper... |
We are using EntLib Logging Application Block. And also it turned out that we should use msmq for logging because of performance.
Now we are trying to use Msmqdistributor service to log those messages in the queue.
What are pros and cons of Msmqdistributor service of Enterprise Library?
Please share your exper... |
What are pros and cons of Msmqdistributor service of Enterprise Library? |
Actually we have been using Rational Team Test, then Robot, but in recent discussions with Rational we discovered they have no plans to support Native x64 applications focusing more on .NET, so we decided to switch Automated QA tools. This is great but licensing costs don't allow us to enable it for all developers.
... |
Finding SQL queries in compiled app. |
|sql-server| |
I have just inherited a server application, however it seems that the only copy of the database is corrupt and the working version is gone, so is it possible to find what queries the application is running so I can try to rebuild the tables? |
I have just inherited a server application, however it seems that the only copy of the database is corrupt and the working version is gone, so is it possible to find what queries the application is running so I can try to rebuild the tables?
Edit: I have some files with no extensions that I are named the same as the... |
I have just inherited a server application, however it seems that the only copy of the database is corrupt and the working version is gone, so is it possible to find what queries the application is running so I can try to rebuild the tables?
Edit: I have some files with no extensions that I are named the same as the... |
They're hints to the compiler to generate the hint prefixes on branches. On x86/x64, they take up one byte, so you'll get at most a one-byte increase for each branch. As for performance, it entirely depends on the application -- in most cases, the branch predictor on the processor will ignore them, these days.
Edi... |
Unit-testing COM written in .NET |
|.net|unit-testing|com| |
Is there a way to unit-test COM-visible .NET assemblies from .NET (not via direct .NET assembly reference)? When i add reference in my test project to the COM component whitten in .NET it complains. |
These are GCC functions for the programmer to give a hint to the compiler about what the most likely branch condition will be in a given expression. This allows the compiler to build the branch instructions so that the most common case takes the fewest number of instructions to execute.
How the branch instructions a... |